<?php if(file_exists('/home/nintendo/public_html/picblur/' . $_POST['file'] . '.png')) { } else { echo "Picture Does Not Exist!"; } $im = imagecreatefrompng('/home/nintendo/public_html/picblur/' . $_POST['file'] . '.png'); $currentheight = 1; $currentwidth = 1; $size = getimagesize('/home/nintendo/public_html/picblur/' . $_POST['file'] . '.png'); $width = $size[0]; $height = $size[1]; while($done !== 'yes') { $rgb = imagecolorat($im, $currentheight, $currentwidth); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $r = 255 - $r; $g = 255 - $g; $b = 255 - $b; $color = imagecolorallocate($im,$r,$g,$b); imagefilledrectangle($im,$currentwidth,$currentheight,$currentwidth,$currentheight,$color); $currentwidth++; if($currentwidth < $width) { } else { if($currentheight <= $height) { } elseif($currentwidth = $width) { $currentheight++; $currentwidth = '1'; } else { $done = 'yes'; } } } header('Image/PNG'); imagepng($im); imagedestroy($im); ?> Code (markup): Why does that return a 500 error?
Perahaps it's because the file does not exist? You test for it but the script still proceeds if it fails the test. Change it to read: <?php if(file_exists('/home/nintendo/public_html/picblur/' . $_POST['file'] . '.png')) { $im = imagecreatefrompng('/home/nintendo/public_html/picblur/' . $_POST['file'] . '.png'); $currentheight = 1; $currentwidth = 1; $size = getimagesize('/home/nintendo/public_html/picblur/' . $_POST['file'] . '.png'); $width = $size[0]; $height = $size[1]; while($done !== 'yes') { $rgb = imagecolorat($im, $currentheight, $currentwidth); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $r = 255 - $r; $g = 255 - $g; $b = 255 - $b; $color = imagecolorallocate($im,$r,$g,$b); imagefilledrectangle($im,$currentwidth,$currentheight,$currentwidth,$currentheight,$color); $currentwidth++; if($currentwidth < $width) { } else { if($currentheight <= $height) { } elseif($currentwidth = $width) { $currentheight++; $currentwidth = '1'; } else { $done = 'yes'; } } } header('Image/PNG'); imagepng($im); imagedestroy($im); } else { echo "Picture Does Not Exist!"; } ?> PHP: