Forum Moderators: coopster

Message Too Old, No Replies

PHP 4.3.1's built-in GD support not working?

         

irock

5:42 pm on Sep 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, I just hired someone to install Ensim along with PHP 4.3.1 for me. However, the imagecreatetruecolor no longer works.

My code is rather simple. If I change from imagecreatetruecolor to imagecreate, image shows up, but only in 'ugly mode.' In phpinfo(), I saw this under GD support.

GD Support enabled
GD Version bundled (2.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled

And here's the code...

<?php
Header("Content-type: image/jpeg");
$orig_image = imagecreatefromjpeg($filename);
list($width, $height, $type, $attr) = getimagesize($filename);
if ($width > 150) {
$ratio = 150 / $width;
$newheight = $ratio * $height; }
else $newheight = $height;

$sm_image = imagecreatetruecolor(150,$newheight) or die ("Cannot Initialize new GD image stream");;

Imagecopyresampled($sm_image,$orig_image,0,0,0,0,150,$newheight,imagesx($orig_image),imagesy($orig_image));
imageJPEG($sm_image);
imagedestroy($sm_image);
imageDestroy($orig_image);
?>

Is there any change from 4.2.2 to 4.3.1 that compromised imagecreatetruecolor() function?

jatar_k

4:19 pm on Sep 7, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I looked through the changelog [ca.php.net] for changes. The only change in 4.3.1 is the cgi vulnerability. GD was upgraded in 4.3.3.

Another thought might be to look through bugs.php.net or to upgrade to 4.3.3 with GD 2.0.15

irock

4:43 pm on Sep 7, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I found out the problem

I was feeding filename to be 'http://www.mydomain.com/image.jpg' which doesn't work

Now, I changed to /image.jpg which work.

So I guess this is a path issue... more than GD core itself.