resizing multiple images: what goes wrong? |
[eluser]JoostV[/eluser]
Hi, I'm trying to resize several instances of a single image. I placed 3 different width, height and thumbnail_marker settings in an array $this->data['config']['image_upload']['art'] Then, I loop through this array. The idea is that 3 different thmbnails will be created in the same folder, each with a different size and name (such as '19_640.jpg, 19_320.jpg' and '19_120.jpg'). image_lib appears to execute the different resizings, but fails to name the thumbs differently. I.e. the same image gets rewritten 3 times, instead of 3 different files being created. So I just end up with a single image 19.jpg in my images folder. Anybody any idea how I can fix this? This is the code: Code: <?php
[eluser]cdevroe[/eluser]
Sad to say, I am having this issue nearly 3 years later.
[eluser]cdevroe[/eluser]
For the sake of keeping this thread up-to-date I wanted to say that I found the solution to this issue. http://makdotgnu.wordpress.com/2009/03/0...deigniter/ Essentially, you use the initialize() and clear() methods rather than loading the library the way the documentation says to do it.
[eluser]JoostV[/eluser]
There's a link to a image resizing lib in my footer that handles multiple image resizing and cropping, if you're interested.
[eluser]ChrisBrad51[/eluser]
A lot of thanks goes to JoostV for his quality decent answer. this really a good post having some important code used for resizing image. Nice sharing.
[eluser]Unknown[/eluser]
Thanks Joost, I was having the same issue with resizing multiple images and this library works perfectly!
[eluser]predat0r[/eluser]
My code works with multi image resize. You don't need extra library.. It's a little triky though.. 1. You have to initialize the $config with initialize() 2. before init you have to use clear() in the loop Code: $this->load->library('image_lib');
[eluser]behnampmdg3[/eluser]
[quote author="predat0r" date="1305986196"]My code works with multi image resize. You don't need extra library.. It's a little triky though.. 1. You have to initialize the $config with initialize() 2. before init you have to use clear() in the loop Code: $this->load->library('image_lib'); |
Welcome Guest, Not a member yet? Register Sign In |