Thumbnails.. (4 posts)

  1. iperez_genius
    Posted 3 years ago #

    When i upload and image to the media manager are all the image sizes set in the media tab under setting created as well?

    at the moment i have an image in a post and i need that same image to be a thumbnail. I am using css and html to resize the image however if the image is huge the resize is okay but effectively the user will have to download the full image.

    I want to load a thumbnail instead.

    What is the best way to achieve this?


  2. Emphacy
    Posted 3 years ago #

    Yes WordPress automatically generates all image sizes from the image you upload, that includes the full size, large, medium, and thumbnail.

    You can select the size of the image you want to insert into the post using the media uploader.


    The thumbnails are the names of the original image with the image size appended to the end, typically thumbnails are 125x125px.

    Hence if you upload an image called hello.jpg and find the URL for that file, typically:


    The thumbnail will therefore be:


  3. iperez_genius
    Posted 3 years ago #

    how do i access this through code?

  4. lucentx
    Posted 3 years ago #

    You could do something like this inside the loop:

      $size = 'thumbnail'; //thumbnail, medium, large or full
      echo get_the_post_thumbnail(get_the_ID(), $size, '');

    Or if you want to create a custom size you can do something like this:

    if ( function_exists( 'add_image_size' ) ) {
      add_image_size( 'homepage-thumb', 220, 130, true );
    echo get_the_post_thumbnail(get_the_ID(), 'homepage-thumb', $attr);

    More info here

Topic Closed

This topic has been closed to new replies.

About this Topic