Problem creating and manipulating Jpegs with GD
| From: | Cherie Benoit | Date: | Wed, 28 Feb 2001 21:09:03 +0000 |
| Subject: | Problem creating and manipulating Jpegs with GD | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-42083@lists.php.net to get a copy of this message | ||
I know you've addressed this already, but I'm still learning a lot of things
and didn't get much from the previous posts. :) I am using a hosting
service, not my own server. So before I complain that they installed the
jpeg module incorrectly I need someone to make sure it is not my code.
This code with Png works fine:
<?php
header("Content-type: image/png");
if (($im = ImageCreateFromPng("test.png")) == "") {
echo "error opening file";
exit;
}
$red = ImageColorAllocate($im, 255, 0, 0);
ImageString($im, 3, 20, 10, "Hi", $red);
ImagePng($im);
?>
However, if I change it to Jpeg it gives me a broken image icon. I get no
other errors.
<?php
header("Content-type: image/jpeg");
if (($im = ImageCreateFromJpeg("test.jpeg")) == "") {
echo "error opening file";
exit;
}
$red = ImageColorAllocate($im, 255, 0, 0);
ImageString($im, 3, 20, 10, "Hi", $red);
ImageJpeg($im);
?>
phpinfo() tell me this:
'./configure'
'--with-gd=/opt/local/src/gd-1.8.4'
'--with-config-file-path=/usr/local/lib'
'--with-ttf=/opt/local/src/freetype-1.3.1'
'--with-jpeg-dir=/opt/local/src/jpeg-6b'
'--libdir=/usr/local/lib/'
Is it me or the server? And what do I tell them to do to fix it?
Thanks!
--
Cherie Benoit