问题描述
我一直在阅读这些文档,并尝试所有的东西来摆脱上传的图片,但我似乎找不到问题。
I’ve been reading the docs and trying everything to make thumbs out of uploaded images but I can’t seem to find the problem.
图片已上传,保存正确,但拇指不,它失败,没有错误输出。
这是我使用的代码:
Images are uploaded and saved correctly but thumbs are not, it fails with no error output.This is the code I’m using:
$data = $this->upload->data();
$config_image['image_library'] = 'gd';
$config_image['source_image'] = $data['full_path'];
$config_image['new_image'] = 'uploads/thumbs/';
$config_image['create_thumb'] = TRUE;
$config_image['maintain_ratio'] = TRUE;
$config_image['width'] = 750;
$this->load->library('image_lib', $config_image);
if ( !$this->image_lib->resize())
{
$this->session->set_flashdata('message', $this->image_lib->display_errors());
}
此外,我想调整图像大小以适合max-width = 750,保持比率。是我做的正确做到了吗?
谢谢!
Also, I want to resize images to fit max-width=750, but maintain the ratio. Is what I’m doing correct to achieve that?Thanks!
推荐答案
你肯定要使用GD2。
You definitely have to use GD2.
CI的图像处理类有时候有些不自然。如果您无法正常工作,请查看。它是一个小的1文件php脚本,在运行时调整图像大小,并使用缓存系统。您只需通过图像标记的src属性传递所需的参数即可。很容易,工作非常好,比CI的图像处理类少得多的头痛。
CI's image manipulation class is a bit temperamental sometimes. If you can not get things to work, check out timthumb. It's a small 1 file php script that resizes images on the fly and uses a caching system. You just pass the required paramters through the src attribute of your image tag. Very easy, works very well and much less of a headache than CI's image manipulation class.
这篇关于resize()无法使用图像处理类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!