views:

266

answers:

2

The following code is not displaying the image from IIS 6/PHP 5.2.9. It works OK from XAMPP (PHP 5.3)

$img = @imagecreate(200, 200);
$background_color = imagecolorallocate($img, 0, 0, 0);
$text_color = imagecolorallocate($img, 233, 14, 91);
imagestring($img, 12, 60, 90,  'image here', $text_color);
header('Last-Modified: ' . date('D, d M Y H:i:s')); 
header('Content-type: image/jpg');
header('Content-Disposition: inline; filename=blank_jpeg.jpg'); 
ob_start();
    imagejpeg($img);
    imagedestroy($img);
    $jpeg = ob_get_contents();
ob_end_clean();
header ('Content-length: ' . strlen($jpeg));
echo $jpeg;
exit;
A: 

More likely than not GD is not installed correctly for IIS.

Turn on error logging, specify an error log and check it for errors when calling the script.

pygorex1
on IE7, it actually outputs jibberish that contains "CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), " so I think the GD is working
kalengi
Turning on error logging has revealed plenty of non-GD errors that must be causing the odd behavior.
kalengi
A: 
kalengi