使用PHP和GD生成的图像已被切断 [英] Generated image using PHP and GD is being cut off

查看:54
本文介绍了使用PHP和GD生成的图像已被切断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这仅在实时服务器上发生.在乘法开发服务器上,按预期创建了映像.

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

LIVE: 红帽

$ 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支持=>启用 GD版本=>捆绑(兼容2.0.34)

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

DEV: Ubuntu 8

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支持=>启用 GD版本=> 2.0或更高版本

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);
?>

在理想环境中,我希望实时服务器和开发服务器运行相同的发行版,但是实时服务器必须是Red Hat.

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.

我的问题是,是否有人知道使用捆绑版的GD会导致图像的最右边部分被切掉的具体区别?

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?

我的内存不足.日志文件中没有生成任何错误.就PHP而言,图像是正确生成的.这就是为什么我认为捆绑版本是GD特有的问题.

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.

推荐答案

也许您的内存不足或类似的东西?您是否仔细检查了所有日志文件等?

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

这篇关于使用PHP和GD生成的图像已被切断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆