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.'_th umbnail_wi dth_pages' ), get_option($shortname.'_th umbnail_he ight_pages '), true );
};
/* -------------------------- ---------- --------- */
?>
Thanks a ton!!!!
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.'_th
};
/* --------------------------
?>
Thanks a ton!!!!
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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,$heig ht,$classt ext,$title text,$titl etext, true);
$thumb = $thumbnail["thumb"]; ?>
THANKS!!!!!
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $thumb = '';
$width = 350;
$height = auto;
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$heig
$thumb = $thumbnail["thumb"]; ?>
THANKS!!!!!
ASKER