开发者

Codeigniter and GD image manipulation

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 开发者_Go百科do not know how to get all the images that the user has upload.

Can anyone suggest anything?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜