Welcome Guest, Not a member yet? Register   Sign In
Another Odd Problem with image manipulation
#1

[eluser]ggoforth[/eluser]
Ok, unless I'm not understanding how this should work, I think I'm doing everything right. Here is my process:

Upload Photo
Resize Photo
Create Thumbnail

All works except the creation of the thumbnail. I can't seem to perform two manipulations on one image. I can't resize it, then create a thumbnail.

here is my resizing code (this part works great):

Code:
$config['image_library'] = 'GD2';
            $config['source_image'] = "./images/imageupload/$imgName";
            $config['maintain_ratio'] = TRUE;
            $config['create_thumb'] = FALSE;
            $config['width'] = 500;
            $config['height'] = 400;

            $this->load->library('image_lib', $config);
            
            if($this->image_lib->resize()){
                $this->image_lib->clear();
                return(true);
            }else{
                $this->image_lib->clear();
                return(false);
            }

Now at this point the uploaded photo has be resized to the right size and now I want a thumbnail to be created. So I call this code:

Code:
$config['image_library'] = 'GD2';
            $config['source_image'] = "./images/imageupload/$imgName";
            $config['dest_images']    = "./images/imageupload/";
            $config['create_thumb'] = TRUE;
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 100;
            $config['height'] = 100;
            
            if($this->image_lib->resize()){
                $this->image_lib->clear();
                return(true);
            }else{
                $this->image_lib->clear();
                return(false);
            }

This results in:

Quote:Your server does not support the GD function required to process this type of image.

Am I missing something here?

Thanks to anyone that can shed some light on this.

Greg
#2

[eluser]mikeyhell[/eluser]
Don't know if you've worked this out or not, but thought I would share a few things I learned today about the image_lib(Or at least what worked for me):

1. After uploading an image, you must supply the server path(e.g. /path/to/website/uploads/image.jpg) as opposed to the base_url().uploads/ or ./uploads/

2. I'm running 6 images at a time through this for a review site, and saw a better benchmarking times when I would upload all the images at once, setting the names into an array. Then running the thumbnails all together, and finally the resize all together. I was running the upload, thumbnail, resize, repeat for each image, and the few times it actually worked it was extremely slow.

Although I experienced some horrendously slow development today, it was much better than working directly with GD.




Theme © iAndrew 2016 - Forum software by © MyBB