0

The PHP function imagecreatetruecolor() won't work on my apache server. I used an example from the PHP manual

header ('Content-Type: image/png');
ini_set('display_error', 'On');
error_reporting(E_ALL);
$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);

Imagemagick and GD where phpinfo gd phpinfo imagemagick succesfully installed. The output in Firefox browser is in translation something like this:

The picture can't be shown because it has errors.

cabanni
  • 349
  • 5
  • 12
  • You have a suppressor symbol on it, which is the `@` symbol. Take this away and you will probably get an actual error message. – GrumpyCrouton Dec 12 '17 at 17:54
  • ok that's right but looks like not in this case, there is no PHP error message, without @ symbol. – cabanni Dec 12 '17 at 17:58
  • Just to confirm the code posted works for me so it must be something in your setup. Have you tried saving the image rather than displaying it in the browser? http://php.net/manual/en/function.imagejpeg.php – Bonzo Dec 12 '17 at 18:03
  • 'imagejpg()' function looks like equal to imagepng($im,$path) i tried this with giving a path but it doesn't work, there is no file output, the output folder is chmod 777 – cabanni Dec 12 '17 at 18:36

0 Answers0