Jump to content

imagecolortransparent problem


bhavin12300

Recommended Posts

hi i have one simple code which add transparent color to image and save it as ".png".

it works fine on my local computer using WAMP.

but when i ran same code on server it generate no output image.

 

my php version is 5.3 and server php versoin is 5.2

here is my code

<?php


$info = getimagesize("rose.jpeg");
$width = $info[0];
$height = $info[1];


$im = imagecreatetruecolor($width, $height);
$image = @imagecreatefromjpeg("rose.jpeg");

$black = imagecolorallocate($im, 255, 255, 255);
imagecolortransparent($im, $black);

imagecopy($im, $image, 0, 0,0 ,0,$width, $height);

imagepng($im, 'output.png');
imagedestroy($im);
?>

 

can you let me know why whats reason? how can i make it run on server?/

 

 

Link to comment
https://forums.phpfreaks.com/topic/186044-imagecolortransparent-problem/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.