• 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?

    Ilan

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    Alternatively:

    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:

    https://yourwebsite/wp-content/uploads/2012/10/hello.jpg

    The thumbnail will therefore be:

    https://yourwebsite/wp-content/upload/2012/10/hello-125×125.jpg

    Thread Starter iperez_genius

    (@iperez_genius)

    how do i access this through code?

    You could do something like this inside the loop:

    <?php
      $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:

    <?php
    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Thumbnails..’ is closed to new replies.