我正在尝试创建用户上传的图像的两个缩略图。我重复了两次代码,对第二个缩略图的配置进行了一些更改,但我只创建了第一个缩略图,而没有创建第二个缩略图。这是代码:
//First Thumbnail
$conf['image_library'] = 'gd2';
$conf['source_image'] = "images/photos/123.jpg";
$conf['create_thumb'] = TRUE;
$conf['thumb_marker'] = "_1";
$conf['maintain_ratio'] = true;
$conf['width'] = 150;
$conf['height'] = 150;
$this->load->library('image_lib', $conf);
$this->image_lib->resize();
//Second smaller Thumbnail
$conf2['image_library'] = 'gd2';
$conf2['source_image'] = "images/photos/123.jpg";
$conf2['create_thumb'] = TRUE;
$conf2['thumb_marker'] = "_2";
$conf2['maintain_ratio'] = true;
$conf2['width'] = 50;
$conf2['height'] = 50;
$this->load->library('image_lib', $conf2);
$this->image_lib->resize();
出于某种原因,第二部分根本不起作用,而第一部分单独工作以及与第二部分一起工作都很好。我想我不应该在同一个地方两次加载图书馆。我能做些什么来解决这个问题?