• Resolved kenn_icuk

    (@kenn_icuk)


    I wanted to register a new image size that i can call through into my widgets to display blog featured images at 90×90.

    Ok so i have added to the functions.php file:
    add_image_size( 'tinythumbnail', 90, 90, true );

    and call it through using:

    if ( has_post_thumbnail() ) { the_post_thumbnail( 'tinythumbnail' ); }

    But the image i upload is like 660 x 200 and when the tinythumbnail custom image size is called through it displays at a scaled version (90 x 27)of the image not at 90×90 as specified and also, not cropped.

    I know people have said this can be an issue due to images needing to be uploaded again, but i have tried it with brand new images and still have the same issue, it is scaling the image to the width and ignoring my height requirement, ANY IDEAS?

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • The default thumbnail is 150px * 150px so just use the thumbnail and pass an array with the size!

    if(has_post_thumbnail()) {
    	the_post_thumbnail( array(90,90) );
    }

    For the twenty eleven theme!

    <?php if(has_post_thumbnail()) : ?>
    	<div class="alignleft">
    	<?php the_post_thumbnail( array(90,90) ); ?>
    	</div>
    <?php endif; ?>

    HTH

    David

    Thread Starter kenn_icuk

    (@kenn_icuk)

    Hello David,

    Thanks for the reply, unfortunately i am already using the thumbnails at 200 by 200 for the main blog overview page, this attempt at add_image_size is so i can render another version out at 90 x 90 for the sidebar.

    That is fine it will resize it on the fly!

    Just paste this in to test

    <?php if(has_post_thumbnail()) : ?>
       <div style="display:block; float:left;">
    	<?php the_post_thumbnail( array(150,150) ); ?>
    	<?php the_post_thumbnail( array(90,90) ); ?>
             <?php the_post_thumbnail( array(50,50) ); ?>
       </div>
    <?php endif; ?>

    David

    Thread Starter kenn_icuk

    (@kenn_icuk)

    Hello again David,

    Thank you very much, after inserting you code and uploading a new image, this has worked amazingly well!!!

    Thank you so very much, this has been killing me two days now, i have seen all the array(width,height) but never got anything to work. obviously just not coded something right.

    Big thumbs up ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add Image Size – doing width but not height or Crop’ is closed to new replies.