gpt4 book ai didi

php - CodeIgniter 中的图像处理

转载 作者:可可西里 更新时间:2023-11-01 01:11:08 24 4
gpt4 key购买 nike

我在使用 CodeIgniter 1.7 处理图像时遇到了一些问题。使用以下代码,图像已正确上传。 las,而不是制作一个新图像,然后进行修改;修改现有图像。有帮助吗?

//Upload image first
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|bmp';

$this->load->library('upload', $config);
$this->upload->do_upload();

//Now fix the image
$picloc = $this->upload->data();
$picloc = $picloc['file_name'];

$thumbnail = "thumb_".$picloc;

$imagemanip['image_library'] = 'gd2';
$imagemanip['source_image'] = './uploads/'.$picloc;
$imagemanip['new_img'] = './uploads/'.$thumbnail;
$imagemanip['maintain_ratio'] = TRUE;
$imagemanip['width'] = 250;
$imagemanip['height'] = 250;

$this->load->library('image_lib', $imagemanip);

$this->image_lib->resize();

最佳答案

问题很简单,你在一行中有一个错字:

$imagemanip['new_img'] = './uploads/'.$thumbnail;

索引应该是“new_image”,而不是“new_img”,所以该行变成..

$imagemanip['new_image'] = './uploads/'.$thumbnail;

关于php - CodeIgniter 中的图像处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/255571/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com