CodeIgniter,在Amazon EC2实例上调整大小后定位缩略图有问题



我在Amazon EC2上生成缩略图时遇到问题。

它在我的本地机器上工作得很好,当我将它部署到Amazon EC2时出现错误

错误/警告是当我试图将缩略图上传到Amazon S3和原始图像上传时。

Severity: User Warning
Message:  S3::inputFile(): Unable to open input file: /tmp/file_name_thumb.jpg
Filename: libraries/S3.php
Line Number: 263

我的控制器的代码是

//This is the config for first image
$config['upload_path'] = sys_get_temp_dir(); // I tried switching this to '/tmp';
$config['allowed_types'] = 'jpg|png';
$config['max_size'] = '500';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['overwrite'] = TRUE;
$this->load->library('upload', $config);
$this->load->library('image_lib');
//Then I do upload
$data = array('upload_data' => $this->upload->data());
// 2nd Config for resize
$config = array(
   'source_image'   => $data['upload_data']['full_path'], //path of the uploaded image
   'new_image'      => sys_get_temp_dir(), //path to target resize, I tried switching this to '/tmp' also ;
   'create_thumb'   => true,
   'maintain_ratio' => true,
   'width'          => 300,
   'height'         => 300,
   'master_dim'     => 'width',);
$this->image_lib->initialize($config);
$this->image_lib->resize();
// Get the path of thumbnail
$fileTempThumbName = sys_get_temp_dir().'/'.$data['upload_data']['raw_name'].'_thumb'.$data['upload_data']['file_ext']; // I also tried replacing the sys_get_temp_dir() with '/tmp'.

$fileTempThumbName是我放入

的参数
$this->s3->putObject($this->s3->inputFile($fileTempThumbName, false),$bucket,$name,$array(),$array())

我的本地运行在OSX 10.8.2与XAMPP和PHP版本5.3.1我的CodeIgniter是2.1.3版本与Amazon S3 PHP类0.4.0

我还在我的Amazon EC2实例上chmod 777 tmp文件夹。

当我检查tmp文件夹时,调整大小的图像不存在。

提前感谢。

问题是我没有在Amazon EC2上安装GD。

安装后,一切运行正常

最新更新