PHP - Problemas Imprimir Imagenes

 
Vista:

Problemas Imprimir Imagenes

Publicado por PabloSutra (1 intervención) el 26/06/2008 19:01:36
Que tal Foreros, tengo un problema tengo una aplicacion donde exporto imagenes dinamicamente con PHP y lo hago un PNG transparente pero me sale con un borde bastante molesto que quiero eliminar y no puedo, alguien me podria ayudar??, desde ya muchas gracias SALUD!!!, les pongo parte del codigo de este PHP:

$w = (int)$_POST['width'];
$h = (int)$_POST['height'];

$img = imagecreatetruecolor($w, $h);

$rows = 0;
$cols = 0;

for($rows = 0; $rows < $h; $rows++){

$c_row = explode(",", $_POST['px' . $rows]);
for($cols = 0; $cols < $w; $cols++){
// get the single pixel color value
$value = $c_row[$cols];
// if value is not empty (empty values are the blank pixels)
if($value != ""){
// get the hexadecimal string (must be 6 chars length)
// so add the missing chars if needed
$hex = $value;
while(strlen($hex) < 6){
$hex = "0" . $hex;
}
// convert value from HEX to RGB
$r = hexdec(substr($hex, 0, 2));
$g = hexdec(substr($hex, 2, 2));
$b = hexdec(substr($hex, 4, 2));
// allocate the new color
// N.B. teorically if a color was already allocated
// we dont need to allocate another time
// but this is only an example
$test = imagecolorallocate($img, $r, $g, $b);
// and paste that color into the image
// at the correct position
imagesetpixel($img, $cols, $rows, $test);
}
}
}

$userDir = _DOCUMENT_HOST_.'/app/files/Recortes/'.$User->id;

header("Content-type:image/png");
imagecolortransparent($img,0x000000);
imagepng($img,$userDir."/caras/cara".time().".png");

$new_width = 500;
$new_height = 350;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder