Jump to content

[image PHP]imagecolortransparent


traxionn

Recommended Posts

Hey all,I'm tring to make a cool dynamic incar view out of multiple imageshttp://trailertrax.net/examensys/extra/final2.jpgNou i've got a problem with the center mirror.I've got a nice top-dashboard incl a center mirror with transpiration (.png)Now i want to fill the center mirror with an image, to bad the sizes doesn't fit. The mirror-image is 900x300 and the center-mirror space is around 700x200.Oke, there is some overlay but i've was thinking let cut that away, with imagecolortransparent (http://php.net/manual/en/function.imagecolortransparent.php)i've create an extra mall and can place it over the center-mirror with showing only the thinks i've need to see. The rest i can convert to transparant and done :)* i've put the extra mall a few pixels below so you can see the problem correctlyThat didnt work, but i think maybe is the correct not correct. Let put a php created color on the image, that needs to work ( left-top)To bad that also didnt work, the blok stats on the image.it seems to not work on mine image :SMy code

$src_img = imagecreatefromjpeg("final.jpg");	$rgb = imagecolorat($src_img, 800, 330);	$r = ($rgb >> 16) & 0xFF;	$g = ($rgb >> 8) & 0xFF;	$b = $rgb & 0xFF;	var_dump($rgb);	$im = imagecreatetruecolor(55, 30);	$blue = imagecolorallocate($im, $r, $g, $b);	imagefilledrectangle($im, 0, 0, 55, 30, $blue);	imagecopy($src_img, $im, 0, 0, 0, 0, 25, 25);// Make the background transparent	$trans = imagecolorallocate($src_img, $r, $g, $b);	imagecolortransparent($src_img, $trans);	imagejpeg($src_img, "final2.jpg");

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...