Processing Multiple Images? |
[eluser]Pawel K[/eluser]
I have been trying to use the image library to resize an image in to a 400x400 thumbnail as well as a 200x200 thumb. I am able to do only the first image, I would appreciate any help in understanding why this is happening. Code: $image_info = $this->upload->data(); Only the first thumbnail (main) gets created. The second one doesn't. No errors show up.
[eluser]pickupman[/eluser]
User guide is your friend. Code: $this->image_lib->clear(); Quote:The clear function resets all of the values used when processing an image. You will want to call this if you are processing images in a loop.
[eluser]Pawel K[/eluser]
I should have said I used that but had same issue although an error would popup that the library doesnt support your image type: Code: else Erorr: Your server does not support the GD function required to process this type of image.
[eluser]pickupman[/eluser]
Shouldn't it be: Code: $this->image_lib->clear(); You have it right for the first image, but a typo for the 2nd.
[eluser]Pawel K[/eluser]
It should be, that was part of me debugging. gd2 does the same thing.
[eluser]pickupman[/eluser]
Can you var_dump the uploaded data to see if the image resources are still available after being processed the first time?
[eluser]Pawel K[/eluser]
Not sure what you mean by var_dump. print_r($image_info); after the last image is processed produces: Code: Array ( echo $config['source_image']; produces: Code: /home/----/public_html/cart/images/products/1273890641-main.jpg The file 1273890641-main.jpg is on the server in the right place with permissions 777. I'm not sure if this is what you are looking for, my apologies if it isn't.
[eluser]atlanta[/eluser]
Hey Pawel K, I finally found it on the 2nd, 3rd , etc calls instead of doing $this->load->library('image_lib', $config); do $this->image_lib->initialize($config); and that will load the new config files.
[eluser]Unknown[/eluser]
Thank you! This thread helped solve my image resizing woes with the CI 2.0 image manipulation class. I was trying to resize a few images in a loop and the docs weren't very clear about how to accomplish this. Here's how I did it: Code: $this->load->library('image_lib'); |
Welcome Guest, Not a member yet? Register Sign In |