• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple Image Upload with Thumbnail + Resize

#1
[eluser]kobeddon[/eluser]
Greetings everyone,

I've been researching about my problem for almost a day and a half now, i cant seem to get it to work. I have a multiple image class, that works perfectly and now i also have a function that creates a thumbnail for each uploaded image. I originally set restrictions on the with and height to preserve its format on the design, however the users would like this restriction taken out since they do not know how to resize an image or too lazy to.

So i took out the limit and placed another resize function of the images that the user would upoad. However it brings me to the classic resize bug in a loop here on CI. Im pretty sure i have my codes right, see below


The function:
Code:
function create_thumbnail($folder, $filename)
{
  $config['image_library'] = 'gd2';
  $config['source_image'] = $folder . $filename;
  $config['maintain_ratio'] = TRUE;
  $config['create_thumb'] = TRUE;
  $config['width'] = 150;
  $config['height'] =100;
  
  $this->image_lib->initialize($config);
  if ( ! $this->image_lib->resize())
  {
   echo $this->image_lib->display_errors();
  }

  unset($config);
        $this->image_lib->clear();
        $this->resizeimage($folder, $filename);
}

function resizeimage($folder, $filename)
{
  $config_resize['image_library'] = 'gd2';
  $config_resize['source_image'] = $folder . $filename;
  $config_resize['maintain_ratio'] = TRUE;
  $config_resize['create_thumb'] = FALSE;
  $config_resize['width'] = 1024;
  $config_resize['height'] =768;
  
  $this->image_lib->initialize($config_resize);
  if ( ! $this->image_lib->resize())
  {
   echo $this->image_lib->display_errors();
  }

  unset($config_resize);
        $this->image_lib->clear();
}


....only the first image being uploaded has successfully created a thumbnail, my mind is exploding here and i need help.... Thanks to anyone who would reply

#2
[eluser]kobeddon[/eluser]
...take note the calling of create_thumbnail function would be inside a loop that is in another function

#3
[eluser]kobeddon[/eluser]
WITH A LITTLE MORE RESEARCH I FOUND THE FIX.... http://ellislab.com/forums/viewthread/141797/ THANKS!!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.