• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image Multi-Thumb

#1
[eluser]MMCCQQ[/eluser]
hi!


i got a question. how can i upload a Image , to get Resize to 640x400 , a Thumb 125x125 AND Thumb 25x25??? how???

#2
[eluser]Eric Cope[/eluser]
do you need more than provided here in the user guide?

#3
[eluser]Rick Jolly[/eluser]
Maybe this code example will help. It's important to use "$this->image_lib->clear();" to reset the image library before a new image is created.

Code:
$upload_data = $this->upload->data();
$image_path = $upload_data['full_path'];
$extension = $upload_data['file_ext'];

$config['image_library'] = 'GD2';
$config['source_image'] = $image_path;
$config['new_image'] = $some_new_image_path . '_large' .  $extension;
$config['maintain_ratio'] = FALSE;
$config['width'] = 640;
$config['height'] = 400;

$this->load->library('image_lib'); // load the image library
$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize())
{
   // error
}


$config['new_image'] = $some_new_image_path . '_medium' . $extension;
$config['width'] = 125;
$config['height'] = 125;

$this->image_lib->clear(); // clear the old config data
$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize())
{
   // error
}

$config['new_image'] = $some_new_image_path . '_small' . $extension;
$config['width'] = 25;
$config['height'] = 25;

$this->image_lib->clear(); // clear the old config data
$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize())
{
   // error
}

#4
[eluser]MMCCQQ[/eluser]
Thank!!! Bros

#5
[eluser]MMCCQQ[/eluser]
what is $some_new_image_path?

#6
[eluser]Rick Jolly[/eluser]
[quote author="MMCCQQ" date="1192693965"]what is $some_new_image_path?[/quote]
The file path of your new image. Maybe this is more clear:
Code:
//$config['new_image'] = $some_new_image_path . '_large' . $extension;
$config['new_image'] = $_SERVER['DOCUMENT_ROOT'] . '/images/your_image_name_large' . $extension);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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