以下是有关服务器,GD库和图像的详细信息。一切都很好,但图像重新调整不起作用。尝试了很多解决方案,但没有运气
print_r(gd_info());
Array
(
[GD Version] => bundled (2.1.0 compatible)
[FreeType Support] => 1
[FreeType Linkage] => with freetype
[T1Lib Support] => 1
[GIF Read Support] => 1
[GIF Create Support] => 1
[JPEG Support] => 1
[PNG Support] => 1
[WBMP Support] => 1
[XPM Support] => 1
[XBM Support] => 1
[JIS-mapped Japanese Font Support] =>
)
print_r(getimagesize('/var/www/testing/uploads/images/eric.jpg'));
Array
(
[0] => 200
[1] => 200
[2] => 2
[3] => width="200" height="200"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
Array
(
[image_library] => gd2
[source_image] => /var/www/testing/uploads/images/eric.jpg
[create_thumb] => 1
[maintain_ratio] =>
[width] => 500
[height] => 800
)
$config['image_library'] = 'gd2';
$config['source_image'] = '/var/www/testing/uploads/images/eric.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = FALSE;
$config['width'] = 500;
$config['height'] = 800;
$this->load->library('image_lib');
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
if (!$this->image_lib->resize()) {
echo $this->image_lib->display_errors();
}
die();
错误:
您的服务器不支持处理此功能所需的GD功能 图像类型。
它在以前的服务器上工作正常,但现在不行。任何想法
答案 0 :(得分:0)
安装PHP时是否有GD支持?在Windows中,您将在php_gd2.dll
中添加GD2 DLL php.ini
作为扩展名。
有关详细信息,请参阅此链接:http://php.net/manual/en/image.installation.php
对于Ubuntu(和Debian),Linux附带了一个名为php5-gd的软件包。只需键入以下命令即可安装此模块:
# apt-get install php5-gd
OR
$ sudo apt-get install php5-gd
答案 1 :(得分:0)
一切都很好,代码正在创建拇指,因为create_thumb选项为true,因此它没有影响原始图像。
我使用此代码进行动态输出,发现php 5.4及更高版本不支持" dynamic_output" for image_lib。为此,我找到了解决方案。