Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    5
    Thanked 0 Times in 0 Posts

    resize the thumbnail pic

    I want to resize both width and height of the thumb pic

    this is the php code
    PHP Code:
    <?php
    $id_member
    =$_SESSION['rid'];
    if(!empty(
    $foto1_name))
                {
            
    $nama_file=$foto1_name;
              
    $anton->sekur_upload($nama_file);
              if(
    $valid)
                      {
                  
    $abpath "conf/i/";
                         @
    copy($foto1$abpath."/".$foto1_name);
                    
    $abang_dom=$abpath."/".$foto1_name;
                         list(
    $width$height) = getimagesize($abang_dom);
                           if(
    $width>200)
                                    {
                             
    make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",200);
                            }
                                else
                             {
                                 
    $tujuan="conf/i/thumb/".$foto1_name;
                                 
    rename($abang_dom$tujuan);
                              }
                     
                  }    
            
            
    $foto_old_name=$foto1_name;
            
    $foto1_name=$id_member."_".$foto1_name;
            
    $foto1_name=strtolower($foto1_name);
            
    $foto1_name=str_replace(' '''$foto1_name);
            
    $asal1="conf/i/".$foto_old_name;
            
    $asal2="conf/i/thumb/".$foto_old_name;    
            
    $tujuan1="conf/i/".$foto1_name;
            
    $tujuan2="conf/i/thumb/".$foto1_name;
                     
    rename($asal1$tujuan1);
               
    rename($asal2$tujuan2);

                     }
    I want to set the size to 100 x 100, which part of the code that I need to edit?

  • #2
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Quote Originally Posted by grandgefx View Post
    I want to resize both width and height of the thumb pic

    this is the php code
    PHP Code:
    <?php
    $id_member
    =$_SESSION['rid'];
    if(!empty(
    $foto1_name))
                {
            
    $nama_file=$foto1_name;
              
    $anton->sekur_upload($nama_file);
              if(
    $valid)
                      {
                  
    $abpath "conf/i/";
                         @
    copy($foto1$abpath."/".$foto1_name);
                    
    $abang_dom=$abpath."/".$foto1_name;
                         list(
    $width$height) = getimagesize($abang_dom);
                           if(
    $width>200)
                                    {
                             
    make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",200);
                            }
                                else
                             {
                                 
    $tujuan="conf/i/thumb/".$foto1_name;
                                 
    rename($abang_dom$tujuan);
                              }
                     
                  }    
            
            
    $foto_old_name=$foto1_name;
            
    $foto1_name=$id_member."_".$foto1_name;
            
    $foto1_name=strtolower($foto1_name);
            
    $foto1_name=str_replace(' '''$foto1_name);
            
    $asal1="conf/i/".$foto_old_name;
            
    $asal2="conf/i/thumb/".$foto_old_name;    
            
    $tujuan1="conf/i/".$foto1_name;
            
    $tujuan2="conf/i/thumb/".$foto1_name;
                     
    rename($asal1$tujuan1);
               
    rename($asal2$tujuan2);

                     }
    I want to set the size to 100 x 100, which part of the code that I need to edit?
    Hard to say without knowing what the make_thumb function does, but an educated guess:
    PHP Code:
                        if($width>100
                                    { 
                             
    make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",100); 
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • Users who have thanked BluePanther for this post:

    grandgefx (01-24-2012)

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    Hard to say without knowing what the make_thumb function does, but an educated guess:
    PHP Code:
                        if($width>100
                                    { 
                             
    make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",100); 
    Hi I did that, but then it lined up the thumbnail pics vertically instead of horizontally, like it used to, why is that?

  • #4
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Quote Originally Posted by grandgefx View Post
    Hi I did that, but then it lined up the thumbnail pics vertically instead of horizontally, like it used to, why is that?
    Impossible to tell without knowing what make_thumb actually does. Probably just a CSS problem.
    Useful function to retrieve difference in times
    The best PHP resource
    A good PHP FAQ
    PLEASE remember to wrap your code in [PHP] tags.
    PHP Code:
    // Replace this
    if(isset($_POST['submitButton']))
    // With this
    if(!empty($_POST))
    // Then check for values/forms. Some IE versions don't send the submit button 
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

  • Users who have thanked BluePanther for this post:

    grandgefx (01-24-2012)

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    Impossible to tell without knowing what make_thumb actually does. Probably just a CSS problem.
    Hi can you point me how to find out what make_thumb does?

  • #6
    Regular Coder
    Join Date
    Apr 2004
    Posts
    298
    Thanks
    0
    Thanked 23 Times in 23 Posts
    1. Unless your original images are square, resizing it to be square will result in distorted images. So you should also look into "cropping" the original before resizing.

    2. You need to search thru the appropriate files for "function make_thumb(" to see how it is handling images


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •