can someone tell me why this only prints a black rectangle.
<?php
header("Content-type: image/jpg");
$a = imagecreatefromjpeg("c:\C.jpg");
$x = imagesx($a);
$y = imagesy($a);
$new = imagecreatetruecolor($x,$y);
imagepalettecopy($new,$a);
for ($count2 =1; $count2 >=$y;$count2++){
for ($count = 1;$count >= $x;$count++){
$pixel = imagecolorat($a,$count,$count2);
$pix = imagecolorsforindex($a,$pixel);
$color = imagecolorallocate($new,$pix['red'],$pix['green'],$pix['blue']);
imagecolorset($new,$pix,$pix['red'],$pix['green'],$pix['blue']);
}
}
imagejpeg($new,"c:/test.jpg");
?>
i know its messy but i was moving things around to see what was wrong.
i updated the code a little bit. now when i try to runt he script it prompts me to download the script. 🙁