我创建了一个带有图片大小调整功能的codeigniter网站。这个网站在我的旧网站空间上运行得很好,现在我已成功将网站转移到我的新网站空间,但不幸的是只调整了小文件大小的图像。 大尺寸图像不会调整大小,也不会显示错误。
我已经检查了以下内容:
memory_limit=64M
,GD2
图片库安装在服务器上,upload_max_filesize=25M
,post_max_size=25M
,max_input_time=300
,max_execution_time=300
这是我使用的调整大小代码:
$query = $this->db->query('SELECT * FROM table1');
foreach ($query->result_array() as $key => $row)
{
//$key value on error is '0'
$config_1['image_library'] = 'imagemagick';
$config_1['source_image'] = $filePath . $fileName;
$config_1['new_image'] = $filePath . 'resized1' . $fileExtension;
$config_1['maintain_ratio'] = TRUE;
$config_1['width'] = 420;
$config_1['height'] = 680;
$config_1['quality'] = 100;
//+ 2 other times the same for $config_2 and $config_3
$this->load->library('image_lib');
$this->image_lib->initialize($config_1);
$this->image_lib->resize();
$this->image_lib->clear();
$this->image_lib->initialize($config_2);
$this->image_lib->resize();
$this->image_lib->clear();
//function quits here with big files (tested with 11 MB files)
$this->image_lib->initialize($config_3);
$this->image_lib->resize();
$this->image_lib->clear();
}
//更新:我现在尝试将图片库更改为ImageMagick以查看它是否有效。现在我收到以下错误(图片未调整大小):
A PHP Error was encountered
Severity: Warning
Message: filesize(): stat failed for test-uploads/files/2016/02/01/resized-file.jpg
Filename: controllers/xyz.php
Line Number: xyz
此处发生错误:
$photo_size1 = filesize($filePath . $fileRename_1) / 1024;