Why does PHP imagejpeg() returns URL instead of image?
Posted: Tue Jul 29, 2008 8:22 pm
I am trying to just get a simple PHP GD code snippet to work but it does not generate an image, only a text of the URL of the page.
The code is located at: http://www.erightsipo.com/certcreator.php and then generates http://www.erightsipo.com/certcreator.php for the output but it should be a jpeg.
What is wrong with the code?
http://www.erightsipo.com/phptest.php shows that GD is working.
Here is the related PHP info:
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.2.1
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
The memory_limit on the site is set to 32M which is more than enough.
?PHP
error_reporting(E_ALL);
header("Content-type: image/jpeg");
$im = imagecreate(200, 200);
$green = imagecolorallocate($im, 0, 255, 0);
imagefill($im, 0, 0, $green);
// no image name
imagejpeg($im, "", 60);
imagedestroy($im);
?>
The code is located at: http://www.erightsipo.com/certcreator.php and then generates http://www.erightsipo.com/certcreator.php for the output but it should be a jpeg.
What is wrong with the code?
http://www.erightsipo.com/phptest.php shows that GD is working.
Here is the related PHP info:
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.2.1
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
The memory_limit on the site is set to 32M which is more than enough.
?PHP
error_reporting(E_ALL);
header("Content-type: image/jpeg");
$im = imagecreate(200, 200);
$green = imagecolorallocate($im, 0, 255, 0);
imagefill($im, 0, 0, $green);
// no image name
imagejpeg($im, "", 60);
imagedestroy($im);
?>