[Solved]Trouble cropping transparent image
Here is the code:
<?php
$w=$_GET['w'];
$h=isset($_GET['h'])?$_GET['h']:$w; // h est facultatif, =w par défaut
$x=isset($_GET['x'])?$_GET['x']:0; // x est facultatif, 0 par défaut
$y=isset($_GET['y'])?$_GET['y']:0; // y est facultatif, 0 par défaut
$filename=$_GET['src'];
header('Content-type: image/png');
header('Content-Disposition: attachment; filename='.$_GET['id']);
$image = imagecreatefrompng($filename);
$crop = imagecreatetruecolor($w,$h);
$trans = imagecolorallocate($im, 0, 0, 0);
imagecolortransparent($crop, $trans);
imagecopy ( $crop, $image, 0, 0, $x, $y, $w, $h );
imagepng($crop);
?>
Any ideas as to why it makes the black pixels transparent also?






Cartoon Clouds
Mountains
Sunrise
Clouds
Green Clouds
None















Help