Hello,I put the coding below.Can anyone help me why its not working.
[code=php]
<?php
header("content-type:image/jpg");
$img=imagecreat efromjpeg("Wint er.jpg");
//Convert $img to truecolor
echo $w = imagesx($img);
echo $h = imagesy($img);
if (!imageistrueco lor($img)) {
$original_trans parency = imagecolortrans parent($img);
//we have a transparent color
if ($original_tran sparency >= 0) {
//get the actual transparent color
$rgb = imagecolorsfori ndex($img, $original_trans parency);
$original_trans parency = ($rgb['red'] << 16) | ($rgb['green'] << 8) | $rgb['blue'];
//change the transparent color to black, since transparent goes to black anyways (no way to remove transparency in GIF)
imagecolortrans parent($img, imagecoloralloc ate($img, 0, 0, 0));
}
//create truecolor image and transfer
$truecolor = imagecreatetrue color($w, $h);
imagealphablend ing($img, false);
imagesavealpha( $img, true);
imagecopy($true color, $img, 0, 0, 0, 0, $w, $h);
imagedestroy($i mg);
$img = $truecolor;
//remake transparency (if there was transparency)
if ($original_tran sparency >= 0) {
imagealphablend ing($img, false);
imagesavealpha( $img, true);
for ($x = 0; $x < $w; $x++)
for ($y = 0; $y < $h; $y++)
if (imagecolorat($ img, $x, $y) == $original_trans parency)
imagesetpixel($ img, $x, $y, 127 << 24);
}
}
imagejpeg($img) ;
?>[/code]
[code=php]
<?php
header("content-type:image/jpg");
$img=imagecreat efromjpeg("Wint er.jpg");
//Convert $img to truecolor
echo $w = imagesx($img);
echo $h = imagesy($img);
if (!imageistrueco lor($img)) {
$original_trans parency = imagecolortrans parent($img);
//we have a transparent color
if ($original_tran sparency >= 0) {
//get the actual transparent color
$rgb = imagecolorsfori ndex($img, $original_trans parency);
$original_trans parency = ($rgb['red'] << 16) | ($rgb['green'] << 8) | $rgb['blue'];
//change the transparent color to black, since transparent goes to black anyways (no way to remove transparency in GIF)
imagecolortrans parent($img, imagecoloralloc ate($img, 0, 0, 0));
}
//create truecolor image and transfer
$truecolor = imagecreatetrue color($w, $h);
imagealphablend ing($img, false);
imagesavealpha( $img, true);
imagecopy($true color, $img, 0, 0, 0, 0, $w, $h);
imagedestroy($i mg);
$img = $truecolor;
//remake transparency (if there was transparency)
if ($original_tran sparency >= 0) {
imagealphablend ing($img, false);
imagesavealpha( $img, true);
for ($x = 0; $x < $w; $x++)
for ($y = 0; $y < $h; $y++)
if (imagecolorat($ img, $x, $y) == $original_trans parency)
imagesetpixel($ img, $x, $y, 127 << 24);
}
}
imagejpeg($img) ;
?>[/code]
Comment