问题描述
我需要一个php脚本的帮助。这是一个已经实施到网站的CMS。尝试添加新产品IMAGE或尝试编辑当前图像时,出现以下错误:
$ b 致命错误:调用未定义的函数imageantialias()in / home /mount/home/m/mclh/web/admin/library/functions.php on line 233
这是我在该领域的代码:
if($ tmpDest ['extension'] ==gif|| $ tmpDest ['extension'] ==jpg)
{
$ destFile = substr_replace($ destFile,'jpg',-3);
$ dest = imagecreatetruecolor($ w,$ h);
imageantialias($ dest,TRUE);
} elseif($ tmpDest ['extension'] ==png){
$ dest = imagecreatetruecolor($ w,$ h);
imageantialias($ dest,TRUE);
} else {
return false;
}
233行是第5行。
UPDATE :看起来函数
imageantialias()
仅在if PHP是用GD编译的,所以它不足足以通过扩展文件包含扩展。 从:
请检查您的 phpinfo()
并查看,如果您发现标记 - with-gd = shared
(或者类似的标志,可能只是 - with-gd
)。如果你找不到它,你的PHP必须用这个标志重新编译。
更多细节:
PHP扩展可以通过包含一个.dll(Windows)或.so(Unix)文件,也可以使用PHP进行编译。编写听起来可怕和疯狂的声音,但其实很简单。所有你需要做的(Unix)是:
- 复制phpinfo()中显示的编译字符串()
- 添加所需的新标志
- 运行
- ./ configure ...所有内容您的phpinfo加上新标志
- 使得干净
- make
- make install
- 查看您的phpinfo()并微笑:)
- copy the compile string which is shown in your phpinfo()
- add the required new flag
- run
- ./configure ... all the stuff from your phpinfo plus the new flag
- make clean
- make
- make install
- look at your phpinfo() and smile :)
第一个答案(并不是正确的):
$ b
imageantialias() code>是的一项功能。 GD是否安装并正确配置?
从您的代码看来,GD已经安装,因为 imagecreatetruecolor()
也是GD功能,似乎工作。这导致了您使用4.3.2之前的PHP版本的结论,该版本不支持 imageantialias()
。
请看看您的phpinfo()以查看我的结论是否正确。在那里你会看到你正在使用的PHP版本,你也会看到GD是否安装并正常工作!
I need help with a php script. It is a CMS that has been implemented into a website. When trying to add a new product IMAGE or trying to edit current images, I am getting the following error:
Fatal error: Call to undefined function imageantialias() in /home/mounts/home/m/mclh/web/admin/library/functions.php on line 233
This is my code for that area:
if ($tmpDest['extension'] == "gif" || $tmpDest['extension'] == "jpg")
{
$destFile = substr_replace($destFile, 'jpg', -3);
$dest = imagecreatetruecolor($w, $h);
imageantialias($dest, TRUE);
} elseif ($tmpDest['extension'] == "png") {
$dest = imagecreatetruecolor($w, $h);
imageantialias($dest, TRUE);
} else {
return false;
}
Line 233 is the 5th line down.
UPDATE: It seems the function imageantialias()
is only available if PHP is compiled with GD, so it is not enough to have the extension included via extension file.
From the PHP manual:
Please check your phpinfo()
and see, if you find the flag --with-gd=shared
(or a similar flag, maybe just --with-gd
) in there. If you can't find it, your PHP has to be recompiled with this flag.
In more details:PHP extensions can either be loaded by including a .dll (Windows) or .so (Unix) file via php.ini or they can be compiled with PHP. Compiling sounds scary and crazy but it is actually really easy. All you need to do (Unix) is:
First answer (didn't turn out to be correct):
imageantialias()
is a function of the PHP GD extension. Is GD installed and properly configured?
From your code it seems that GD is installed because imagecreatetruecolor()
is also a GD function and seems to work. This leads to the conclusion that you're using a PHP version prior to 4.3.2, which doesn't support imageantialias()
.
Please look at your phpinfo() to see if my conclusions are correct. There you will see what version of PHP your are using and you will also see if GD is installed and working!
这篇关于imageantialias在安装GD时调用未定义的函数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!