Link to home
Start Free TrialLog in
Avatar of ThankDog
ThankDog

asked on

In Word Press, how do I scale thumbnails down a percentage in PHP?

Hi, I'm using word press for my blog.  The home page calls the pictures from each post to appear as a thumbnail above the text.  The thing is...instead of it resizing the picture to a certain percentage and keeping it proportional, it literally sizes it down and then clips the picture to fit 120 x 120...so the picture is not only super small, but totally cut off.  I want the picture to be big enough to see and to be proportional...

www.thankdogblog.com 

Here is the php code:

<?php

/* sets predefined Post Thumbnail dimensions */
if ( function_exists( 'add_theme_support' ) ) {
      add_theme_support( 'post-thumbnails' );
      
      //home.php, index.php, single.php
      add_image_size( 'homepage', 120, 120, true );

      //page image size
      add_image_size( 'pageimage', get_option($shortname.'_thumbnail_width_pages'), get_option($shortname.'_thumbnail_height_pages'), true );
            
};
/* --------------------------------------------- */

?>


Thanks a ton!!!!
ASKER CERTIFIED SOLUTION
Avatar of gwkg
gwkg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ThankDog
ThankDog

ASKER

I used what he suggested and then found out I gave the wrong code so it didn't work.  But because of that, I was able to tweak the code I found to what he said and it worked!
Hi gwkg...first, thank you for your time. I realized I gave the wrong PHP code that was actually doing the controlling, so when I used what you said it didn't work. However, when I realized there was another php file, I took your guidance and edited the block of coding with better understanding....

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                                    
                                          <?php $thumb = '';
                                                  $width = 350;
                                                  $height = auto;
                                                  $classtext = '';
                                                  $titletext = get_the_title();
                                          
                                                  $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext, true);
                                                  $thumb = $thumbnail["thumb"]; ?>

THANKS!!!!!