tags:

views:

1331

answers:

6

This is only happening on the live server. On multiply development servers the image is being created as expected.

LIVE: Red Hat

$ php --version
PHP 5.2.6 (cli) (built: May 16 2008 21:56:34) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

GD Support => enabled GD Version => bundled (2.0.34 compatible)

DEV: Ubuntu 8

$ php --version
PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 23 2008 06:44:49) 
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

GD Support => enabled GD Version => 2.0 or higher

<?php
$image = imagecreatetruecolor($width, $height);

// Colors in RGB
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0); 

imagefilledrectangle($image, 0, 0, $width, $height, $white);

imagettftext($image, $fontSize, 0, 0, 50, $black, $font, $text);
imagegif($image, $file_path);
?>

In a perfect world I would like the live server and the dev server to be running the same distro, but the live server must be Red Hat.

My question is does anyone know the specific differences that would cause the right most part of an image to be cut off using the bundled version of GD?

EDIT: I am not running out of memory. There are no errors being generated in the logs files. As far as php is concerned the image is being generated correctly. That is why I believe it to be a GD specific problem with the bundled version.

+2  A: 

Maybe you are running out of memory or something similar? Did you double check all logfiles, etc.?

Till
A: 

Is it 100% consistent and always at the same place? If not, it might be a resource issue -- time to execute the script or memory limitation. Try tweaking the php.ini settings, rebooting web server, testing.

Devin Ceartas
A: 

Are you running the same version of PHP on both servers? Post the relevant PHP code you're using to generate the image.

David
Heck, post all of phpinfo for each machine.
Adam Davis
A: 

Does it depend on the image ?

Recently I discovered a strange bug/feature in PHP & GD.

When trying to resize and edit JPEGs that had an all white background (c. 3MB), it would fail. It DID work with other images that were larger (c. 4MB), and more complicated backgrounds.

I worked out that when GD opened the images to edit, the white back ground images grew by a greater ratio than the more complex images. This ratio for some images caused PHP/GD to fail and cut of images halfway.

William

William Macdonald
A: 

Have you had the value of $width output to see whether it is correct?

NineBerry
A: 

It might not be the image is being cut off. It might be the text being cut off.

-> imagettftext($image, $fontSize, 0, 0, 50, $black, $font, $text);

TTF font has overhead and paddings. Try a larger canvas see if the you get the same result.

Darkerstar