CodeIgniter multipLe图像缩略图问题:

时间:2011-08-01 09:20:33

标签: codeigniter

  

可能重复:
  CodeIgniter Image thumbnailing issue

我想为同一张图片创建两个不同大小的缩略图。在我的代码中只创建了第一个缩略图代码 并发生以下错误。 错误:“您的服务器不支持处理此类图像所需的GD功能。”

function createThumb1($imageName)  //file name passed
{   


        // this thumbnail created
    $config['image_library'] = 'gd2';
    echo $config['source_image']    = $_SERVER['DOCUMENT_ROOT'].'/uploads/'.$imageName;

    $config['create_thumb'] = TRUE;
    $config['maintain_ratio'] = false;
    $config['width']     = 80;
    $config['height']   = 80;
    $config['new_image'] = $_SERVER['DOCUMENT_ROOT'].'/images/uploads/thumbs/'.$imageName;
    $this->load->library('image_lib', $config);
    if ( ! $this->image_lib->resize()){echo $this->image_lib->display_errors();}

    $this->image_lib->clear();

    // unable to create this this thumbnail
    $config['image_library'] = 'gd2';
    echo $config['source_image']    = $_SERVER['DOCUMENT_ROOT'].'/uploads/'.$imageName;
    $config['create_thumb'] = FALSE;
    $config['maintain_ratio'] = false;
    $config['width']     = 696;
    $config['height']   = 241;
    $config['new_image'] =  $_SERVER['DOCUMENT_ROOT'].'/images/uploads/'.$imageName;
    $this->load->library('image_lib', $config);
    if ( ! $this->image_lib->resize()){echo $this->image_lib->display_errors();}


    $this->image_lib->clear();






    $this->load->view('admin/upload_form',array('error' => ' ' ));





}

请解决我的问题我从上周开始工作,问题得不到解决

1 个答案:

答案 0 :(得分:0)

您使用GD库调整未在机器上安装/未正确配置的图像的大小。安装GD可能会解决问题。

GD php.net Page