我正在尝试使用gd库对单色png图像进行重新着色。我在另一篇文章中发现了一个代码,可以给gif重新着色。我已经修改了该代码以与透明的png一起工作。这是我的代码。我可以用这段代码创建一个新的png文件,但颜色不变。请谁帮我改变一个透明的png的颜色。
<?php
// first we will create a transparent image. an image that has no color.
$width = 300; $height=340;
$image = imagecreatetruecolor($width,$height); //black image of t
我把php更新到了5.3。但我无法安装gd扩展(在freebsd 8.3上)
错误行:
# cd /usr/ports/graphics/php5-gd/
# make install clean
===> php5-gd-5.3.11 depends on file: /usr/local/bin/phpize - found
===> php5-gd-5.3.11 depends on file: /usr/local/bin/autoconf-2.69 - found
===> php5-gd-5.3.11 depends on shared library
我正在内部网服务器w/o连接上运行php,并且没有安装任何图形库。现在,我需要创建一个16x16像素的彩色块(着色#86D0FF),并想知道是否有一种方法可以为这样简单的事情返回所需的字节序列,而不必安装库?
换句话说:我想在不安装GD的情况下实现以下目标:
<?php
header("Content-Disposition: Attachment;filename=image.png"); // so that it can be saved...
header("Content-type: image/png");
$img
看起来我的主机支持gd,但我还是收到一个错误( PHP版本5.3.28 )
Fatal error: Call to undefined function imagecreatefromjpeg()
下面是我的phpinfo:
gd
GD Support enabled
GD Version bundled (2.1.0 compatible)
GIF Read Support enabled
GIF Create Support enabled
PNG Support enabled
libPNG Version 1.2.44
WBMP Support enabled
我有一个工作的Drupal站点,我试图将我的5.5版本升级到Drupal6。尝试从端口集合更新版本之后:
cd /usr/ports/www/drupal6
make install ; make clean
我收到一个错误:
autoconf: required version 2.68 not found
然后,我转到用于autoconf的端口目录,并运行: make;make
所有安装都是正确的,但当我试图重新安装drupal6时,我会收到相同的错误消息,即:
=> SHA256 Checksum OK for php-5.3.5.tar.bz2.
===> Pat
如何让imageantialias()起作用?
代码:
imageantialias($image, true);
错误:
Fatal error: Call to undefined function imageantialias() in /var/www...
信息:
PHP Version 5.3.3-7+squeeze3
gd
GD Support enabled
GD Version 2.0
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.4.2
T1Lib
我正在使用Apache / Ubuntu配置。
安装php-gd库后,我将在/chroot/httpd/var/log/apache2/error.log文件中获得错误消息(在我的着色环境中,/chroot/httpd/是“监狱”):
Error opening file for reading: No such file or directory
我的问题是,这个日志没有提到丢失的文件名。知道我怎么找出罪魁祸首吗?
很确定这与GD有关,可能是在复制到着色部分时丢失的某个文件,但我不知道该在哪里查找丢失的文件。
感谢任何有想法的人。
我试图使用运行EC2的AWS CentOS实例部署Wordpress网站。我正在使用wordpress 5.7.2、PHP 8.0.6和Apache 2.4.46。我已经成功地建立和运行了这个网站,但是在我的网站“健康状况”中我看到了以下问题:
The required module, gd, is not installed, or has been disabled.
我知道我已经安装了gd,因为当我在实例中SSH并键入sudo yum info gd命令时,我会收到以下输出:
Loaded plugins: extras_suggestions, langpacks, prioritie
我在尝试上传png时遇到了GD的问题。我得到的错误是
Warning: imagepng(): gd-png error: compression level must be 0 through 9... on line 2474
在php_image_magician.php中的第2474行是png的例子
case '.png':
// *** Scale quality from 0-100 to 0-9
$scaleQuality = round(($imageQuality/100) * 9);
// *** Inver
我正在尝试添加一些功能的PHP GD安装。我使用Docker PHP“官方”版本作为基础(php:7.1.15-fpm-jessie)。
我当前的生产环境使用CentOS,它的GD模块支持FreeType、JPEG和PNG,您可以在phpinfo输出中看到:
GD Support => enabled
GD headers Version => 2.2.5
GD library Version => 2.2.5
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Versio
我有一个彩色图像,我想改变这个颜色与GD库。图像是一个巴布亚新几内亚,我也想保持透明度。我编写了以下代码,以保持透明度和更改颜色,但由此产生的颜色不是我在imagefilter函数中使用的颜色。例如,如果我传递0,0,255,那么产生的图像颜色将是194,194,255。
请帮我解决这个问题。这是我的密码。
<?php
// first we will create a transparent image. an image that has no color.
$width = 294; $height=333;
$image = imagecreatetruecolor($width
我有一个使用PHP从文本生成图像的脚本。它工作得很好,除了我希望它能生成不同颜色的多行文本。如何使用PHP、GD和Freetype来实现?下面是我用来生成单行文本图像的代码。
$textval = 'This is some text to be an image';
$textcolor = '666666';
$font="arial.ttf";
$size = 9;
$padding= 1;
$bgcolor= "ffffff";
$transparent = 0;
$antialias = 0;
$fontfile
我试了我能找到的所有东西。
我安装了完整的gd,我的php信息显示如下
GD Support enabled
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.11
GIF Read Support enabled
GIF Create Support enabled
PNG Support enabled
libPNG Version 1.2.49
WBMP Support e