Codeigniter中的Image_lib不会产生输出

时间:2014-04-01 15:06:24

标签: php codeigniter

这似乎是一个相当普遍的问题,但我无法找到问题的答案,也无法自己提出解决方案。我试图使用image_lib类的resize方法,以使一些图像更小。这是代码:

function manipulate_picture($img_path, $hashed_id) {
    $destination_image = 'img/entries_small/' . $hashed_id;
    $config['image_library'] = 'GD2';
    $config['source_image'] = $img_path;
    $config['maintain_ratio'] = FALSE;
    $config['width'] = 130;
    $config['height'] = 75;
    $config['new_image'] = $destination_image;

    $this->CI->load->library('image_lib', $config);
    $this->CI->image_lib->resize();

    echo '<img src="'.base_url($config['new_image']).'">';

    return $destination_image;
}

由原始图像的路径和同一图像的hashed_id调用。回显代码显然只是用于测试 - 但它不会产生任何输出(并且在服务器上也找不到文件)。我已经检查过GD2是否通过phpinfo()启用了。我还检查了在调用load之后image_lib被加载了。

我真的不知道如何处理这个问题。

0 个答案:

没有答案