• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I make multiple thumbails for the same image with image_lib?

#12
[eluser]SitesByJoe[/eluser]
[quote author="Bramme" date="1216576255"]
Code:
function process_uploaded_image($filename){
    
    $large_path = $this->config->item('portfolio_path').$filename;
    $thumb_path = $this->config->item('thumbs_path').$filename;
    
    //get image size
    $img_size = getimagesize($large_path);
    $orig_width = $img_size[0];
    $orig_height = $img_size[1];
    
    if($orig_width > $orig_height) {
    //horizontal picture
        $res_width = 450;
        $res_height = 10;
        $set_master_dim = 'width';
    } else {
    //vertical picture
        $res_width = 10;
        $res_height = 400;
        $set_master_dim = 'height';
    }
    ....
[/quote]

Bramme (or anyone else),

Would you be so kind as to explain the calculations you use to figure our your resizing? I have some weird sizes to make my thumbnails into (squares AND rectangles) and understanding the math would free me to finish my scripts.

Sizes I need right now from the original:

582 x 350
100 x 75
50 x 50

Of course I'll never know what size image I'm starting with...

Thanks!


Messages In This Thread
How do I make multiple thumbails for the same image with image_lib? - by El Forum - 10-20-2008, 07:14 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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