WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Post Thumbnail cropping issue (8 posts)

  1. andyhoyland
    Member
    Posted 3 years ago #

    Hi all

    I've hunted around but can't seem to get to the bottom of this - might be a case of me not hunting very well slow please point me in the right direction if I'm repeating a questing sorted somewhere else...

    I am using <?php the_post_thumbnail(); ?> to call featured images from my posts but I'm having some issues with the sizing of them

    In my functions.php I have set up different image sizes.

    And I have the thing working perfectly on my localhost (running on Windows 7 through XAMPP) However - when I upload my theme to a live install the image sizes have no impact - so I have set up an image size that is 290px x 485px but when it is called it is just showing the image width 290px but then scaled down to show the complete image.

    Does anyone know what might be causing this?! I've probably not given enough information...

    The image size setting in functions.php looks like this:

    add_theme_support( 'post-thumbnails' );
    add_image_size('smallpagefeatured', 335, 320, true);

    and then the call in the page template is:

    <?php the_post_thumbnail('smallpagefeatured'); ?>

    Many thanks for your time
    Andy

  2. andyhoyland
    Member
    Posted 3 years ago #

    Ok.

    I took a friend's advice and had a break over Christmas. But now coming back to this I am still unable to solve the problem.

    I've uploaded some screenshots to show you what I mean. The first two are from my localhost, the second two are uploaded to a server. Does anyone know of a reason why these two are not displaying the same? I guess it must be something to do with server configuration but I don't know what! Anyone seen it before / point me right direction.

    The examples show a category page with a small image on the left that is governed by the_post_thumbnail and then a single page with a larger image governed by the_post_thumbnail

    Many thanks...

    Images - Correct on localhost:
    Category page
    Single post page

    Images - incorrect on server:
    Category page
    Single post page

    Andy

  3. Curtiss Grymala
    Member
    Posted 3 years ago #

    Most likely, your production server does not have the GD library installed. That is the library (from what I've been able to ascertain) that WordPress uses for image manipulation.

    You can check with your Web host to see if they have it installed and, if not, to see if they'll set it up for you.

  4. andyhoyland
    Member
    Posted 3 years ago #

    Woohoo.

    Thanks Curtiss. I'll follow that up.

    Have a great day.
    Andy

  5. andyhoyland
    Member
    Posted 3 years ago #

    Hi again.

    I've taken a look at the GD library on my server - it is installed and all looks to be the same as my localhost.

    The PHP version is slightly older on my localhost and my server is Linux (as opposed to Windows XAMPP on my PC)

    I'll keep digging!

    Thanks again for your reply though.
    Andy

  6. Curtiss Grymala
    Member
    Posted 3 years ago #

    Next question (although I'm guessing it's configured properly if the images are getting uploaded in the first place) - Have you checked the file permissions to make sure WordPress (i.e. the apache user) has permission to write files in your uploads directory?

    Also, just to make sure, the images you're uploading aren't larger than 1 or 2 megabytes, are they? Sometimes GD can choke on really large files.

  7. andyhoyland
    Member
    Posted 3 years ago #

    Curtiss - I'm sorry!

    I've been a bit stupid. It was just a case of not uploading the images properly - I'd imported the data from my localhost and so hadn't uploaded the images into the posts. When I re did the uploads all worked out...

    Thanks for your pointers though - I now know a bit more about the GD Library which is a good thing!

    Have a great day.
    Andy

  8. Curtiss Grymala
    Member
    Posted 3 years ago #

    Awesome. I'm glad you were able to get it straightened out.

    If ever you run into a similar situation, you might want to try the Regenerate Thumbnails plug-in. I'm not sure if it is able to generate thumbnails from images that are manually uploaded via FTP or not, but it's worth a shot.

Topic Closed

This topic has been closed to new replies.

About this Topic