Codeigniter 和 GD 图像处理

发布于 2024-08-15 12:46:44 字数 752 浏览 6 评论 0原文

在 codeigniter 中,我正在创建一个应用程序,允许用户一次性上传多个文件,对此我正在使用这个库, http://www.mitesdesign.com/blog/open-source/multi-upload-jquery-code-igniter

我的问题是是否有已上传的多个图像如何在 $config 中定义源图像,到目前为止我已经这样做了,

                    $gd['image_library'] = 'gd2';
            $gd['source_image'] = '';
            $gd['create_thumb'] = TRUE;
            $gd['maintain_ratio'] = TRUE;
            $gd['width'] = 164;
            $gd['height'] = 103;
            $this->load->library('image_lib', $gd);
            $this->image_lib->resize();

您可以看到 source_image 是空的,因为我不知道如何获取用户上传的所有图像。

任何人都可以提出任何建议吗?

In codeigniter I am creating an application that allows the user to upload multiple files in one go, to this I am using this library, http://www.mitesdesign.com/blog/open-source/multi-upload-jquery-code-igniter

My question is if there are multiple images that have been upload how do I define the source image in the $config, so far I have done this,

                    $gd['image_library'] = 'gd2';
            $gd['source_image'] = '';
            $gd['create_thumb'] = TRUE;
            $gd['maintain_ratio'] = TRUE;
            $gd['width'] = 164;
            $gd['height'] = 103;
            $this->load->library('image_lib', $gd);
            $this->image_lib->resize();

as you can see the source_image is empty as I do not know how to get all the images that the user has upload.

Can anyone suggest anything?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

潇烟暮雨 2024-08-22 12:46:44

查看本文 ZIP 中提供的 Multi_upload 库,您所要做的就是:

$files = $this->multi_upload->go_upload();

这将返回一个如下所示的多维数组:

                        'name' => $CI->upload->file_name,
                        'file' => $CI->upload->upload_path.$CI->upload->file_name,
                        'size' => $CI->upload->file_size,
                        'ext' => $CI->upload->file_ext,
                        'image_type' => $imageVar->image_type,
                        'height' => $imageVar->height,
                        'width' => $imageVar->width

然后只需进行 foreach 并在调整大小代码中使用这些详细信息。

Looking at the Multi_upload library supplied in the ZIP in this article, all you have to do is this:

$files = $this->multi_upload->go_upload();

That will return a multi-dim array like this:

                        'name' => $CI->upload->file_name,
                        'file' => $CI->upload->upload_path.$CI->upload->file_name,
                        'size' => $CI->upload->file_size,
                        'ext' => $CI->upload->file_ext,
                        'image_type' => $imageVar->image_type,
                        'height' => $imageVar->height,
                        'width' => $imageVar->width

Then just foreach through and use those details in your resizing code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文