Welcome Guest, Not a member yet? Register   Sign In
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


Messages In This Thread
Multiple Image Upload with Thumbnail + Resize - by El Forum - 03-07-2012, 03:43 AM
Multiple Image Upload with Thumbnail + Resize - by El Forum - 03-07-2012, 03:45 AM
Multiple Image Upload with Thumbnail + Resize - by El Forum - 03-07-2012, 04:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB