Can anyone tell me why the following code doesn't work? It outputs images with ZERO bytes -- but here's the kicker: the below code works correctly (outputs images with a normal number of bytes) when I change "png" to "jpg" or "jpeg". The src file for the png code is bigpic.png, which contains a simple butterfly icon with a transparent background. I have an include that creates the transparency, however that's not causing the 0-bytes problem, since the script outputs 0-byte images when when I omit that particular include.)
Thanks for any ideas.
<?php
$x=$_REQUEST['x'];
$y=$_REQUEST['y'];
$x_change=$_REQUEST['x_change'];
$y_change=$_REQUEST['y_change'];
$numberofpics=$_REQUEST['numberofpics'];
$filename=$_REQUEST['filename'];
$c=0;
//SRC FILE IS A 1040x1040 PICTURE OF A BUTTERFLY ICON WITH TRANSPARENT BACKGROUND
while ($c<$numberofpics) {
$src=$_REQUEST['src'];
$src = imagecreatefrompng($src);
$src_width=imagesx($src);
$src_height=imagesy($src);
$dest = imagecreatetruecolor(640, 360);
$c=$c+1;
imagecopy($dest, $src, 0, 0, $x, $y, 640, 360);
header('Content-Type: image/png');
$thisfilename=$filename.$c.".png";
imagepng($dest,$thisfilename,100);
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
$x=$x+$x_change;
$y=$y+$y_change;
}
?>