• Hi,

    I have installed the post thumbnail into my latest wordpress system.
    And it works fine – the image displays on the homepage as requested.
    One issue tho, is that i cannot get it to be 300x600px in size. It only seems to go to 300×300??

    Please can someone help me solve this.

    PS. The site is on local machine at the moment.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Try adding:

    if ( function_exists( 'set_post_thumbnail_size' ) ) {
    	set_post_thumbnail_size(300, 600, true ); // hard crop, fixed, mode
    }

    to your theme’s functions.php file.

    Thread Starter welshhuw

    (@welshhuw)

    Hi,
    I have that exact coding.
    Im trying to get my image to display at 564x206px.
    It displays at 206 high, but only about 300px wide??

    And i have this in my index.php:
    <a href="<?php the_permalink() ?>"<?php the_post_thumbnail(array( 564, 206, true ), array( 'class' => 'alignleft' )); ?></a>

    Help!!

    In functions.php, try:

    if ( function_exists( 'set_post_thumbnail_size' ) ) {
    	set_post_thumbnail_size(300, 600, true ); // hard fixed/crop mode
    }
    if ( function_exists( 'add_image_size' ) ) {
    	add_image_size( 'index-post-thumbnail', 564, 206, true ); //
    }

    Then, in index.php use:

    <a href="<?php the_permalink() ?>"<?php the_post_thumbnail('index-post-thumbnail'); ?></a>

    Thread Starter welshhuw

    (@welshhuw)

    Still didn’t work??
    This is weird.

    functions.php:

    add_theme_support('post-thumbnails');
    if ( function_exists( 'set_post_thumbnail_size' ) ) {
    	set_post_thumbnail_size(564, 206, true ); // box (proportional) resize mode
    }

    index.php:

    <div class="img-holder">
    <div class="post-img">
    <a href="<?php the_permalink() ?>"<?php the_post_thumbnail(array( 564, 206, true ), array( 'class' => 'alignleft' )); ?></a>
    </div>
    </div>

    CSS:

    .img-holder {
    		width:600px;
    		height:245px;
    		background:url("img/img-holder.gif") no-repeat;
    	}
    
    		.post-img {
    			/*background:#000;*/
    			width:564px;
    			height:206px;
    			position:relative;
    			top:14px;
    			left:15px;
    		}

    Thread Starter welshhuw

    (@welshhuw)

    The other issue is that the images don’t appear in IE7/8 or Opera??

    I have the same problem.

    Sadly, the hard crop mode seems not to function.

    Example:

    in my functions.php file

    add_image_size( 'new_thumbnail_size', 300, 100, true );

    in my theme file (ex. single.php)
    if ( has_post_thumbnail() ) { the_post_thumbnail( 'new_thumbnail_size' ); }

    The image is not cropped as wanted. The height is good but the width stays proportionnal to the height, so in my case, the width is less than 300 pixels.

    Weird, weird, weird. I also use version 2.9.1. Maybe the 2.9.2 fixed the bug?

    Thread Starter welshhuw

    (@welshhuw)

    HI Welshhuw,

    Are you saying that you followed Mark’s instructions and got the hard crop to work?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom homepage thumbnail size?’ is closed to new replies.