Welcome Guest, Not a member yet? Register   Sign In
Best Practice for Images : Generating Thumbs or Resizing on the Fly

Thanks for replies. Still doing some debugging here, but I wanted to report in on what I'd found and see if I could get some thoughts on it. Really appreciate the help so far.

At the moment, my memory_limit seems to be set to 8MB and my max_execution time is set to 30 seconds.

The test image I'm uploading to be processed is 36kb.

In my upload script which handles the resizes, I'm calling my do_resize() method three times (in theory), and passing necessary values to it for the three sizes of images I'd like to generate.

Currently, my debugger consists only of echoing out whatever information I can to make sure I've met the requirements needed for the $this->image_lib->resize() method to work. At the moment, everything appears to look good, and the image_lib->resize() method still returns true for each of the do_resize()s I call. However, I have noticed that, regardless of how many times I call CI's resize(), it only appears to work for one image type.

To test, I started by only calling my do_resize() once to generate thumb-sized images. It worked perfectly. Next, I added a second call to do_resize(), passing it a slightly different new image path and values for the width and height, etc, to generate the medium-sized images. I returned 'true' for both calls, however, only the first do_resize() (thumbs) actually worked.

Next, I took out the call to thumbs to see what would happen if I only tried to generate the medium-sized images. When I ran the script, the medium-sized images were generated, which suggests that I can't call resize() more than once.

Is it possible that calling this method on a 36kb image would trip an 8MB memory_limit, and would that show up in the php error log? (I did check the error log, and no errors were recorded).

Is there a way to do what I'm trying to do which is more efficient than what I'm currently trying? (If code samples would help at all, I'll be happy to post them.)

Thanks for reading.

In case anybody is still curious about this, I have to admit, I've been a bit dense. The reason the multiple resize calls are failing is that I need to call the image_lib->clear() method to process multiple images in a loop. Thank you CI manual...

Theme © iAndrew 2016 - Forum software by © MyBB