gpt4 book ai didi

php - 安装了 GD 后 imageantialias 调用未定义函数错误

转载 作者:IT王子 更新时间:2023-10-29 00:12:29 27 4
gpt4 key购买 nike

我需要有关 PHP 脚本的帮助。它是一个已在网站中实现的 CMS。尝试添加新产品图像或尝试编辑当前图像时,出现以下错误:

fatal error :调用/home/mounts/home/m/mclh/web/admin/library/functions.php 中的未定义函数 imageantialias() 第 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 行。

最佳答案

更新:看来函数imageantialias()只有在PHP用GD编译时才可用,所以不够通过扩展文件包含的扩展。

来自PHP manual :

Note: This function is only available if PHP is compiled with the bundled version of the GD library.

请检查您的 phpinfo() 并查看是否找到标志 --with-gd=shared (或类似的标志,也许只是 - -with-gd) 在那里。如果你找不到它,你的 PHP 必须用这个标志重新编译。

更多细节:PHP 扩展可以通过 php.ini 包含 .dll (Windows) 或 .so (Unix) 文件来加载,也可以用 PHP 编译。编译听起来很可怕和疯狂,但实际上很容易。您需要做的 (Unix) 是:

  1. 复制 phpinfo() 中显示的编译字符串
  2. 添加所需的新标志
  3. 运行
    • ./configure ... 来自你的 phpinfo 的所有东西加上新标志
    • 打扫卫生
    • 制作
    • 安装
  4. 看看你的 phpinfo() 并微笑 :)

第一个答案(结果证明是不正确的):

imageantialias()PHP GD extension 的函数. GD 是否已安装并正确配置?

从您的代码看来,GD 似乎已安装,因为 imagecreatetruecolor() 也是一个 GD 函数并且似乎可以工作。由此得出结论,您使用的是 4.3.2 之前的 PHP 版本,该版本不支持 imageantialias()

请查看您的 phpinfo() 以查看我的结论是否正确。在那里您将看到您正在使用的 PHP 版本,您还将看到 GD 是否已安装并正常工作!

关于php - 安装了 GD 后 imageantialias 调用未定义函数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5756144/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com