Michael
Michael

Reputation: 157

PHP image failing to do, well, anything

<?php
header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
      or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);
?>

That should work, but is just showing a blank page. I have php-gd installed. Help?

Upvotes: 0

Views: 66

Answers (1)

afuzzyllama
afuzzyllama

Reputation: 6548

Try some debugging steps:

  1. Turn on error reporting
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', 'On');
  2. Remove the header()
  3. Remove the @ from @imagecreatetruecolor()
  4. See what errors you are receiving.

Upvotes: 4

Related Questions