Viewing 10 replies - 1 through 10 (of 10 total)
  • WP crops images only once upon upload, so when changing theme or some settings relating to image size, you have to delete previously uploaded images and re-upload them to get the new sizes.

    This plugin helps resize images easily.
    https://www.ads-software.com/plugins/regenerate-thumbnails/

    Thread Starter ValentinePills

    (@valentinepills)

    My images aren’t thumbnail size. They are true to size of this particular theme. I’ve tried everything and this theme is stretching images that don’t need to be stretched.

    In WP “Thumbnail” is also used as another term for featured image.

    I installed this theme in my local dev to test it out, it does “stretch the images”, but this is expected and is a standard way of styling image in responsive design ( 100% max-width and auto height ).

    The registered image size (for thumbnail, feature image) of this theme is this

    set_post_thumbnail_size( 770, 295, true );

    So any newly uploaded image should be bigger than 770×295. For images already uploaded, they need to be cropped (with this new size) using that plugin or manually delete and re-uploaded.

    Thread Starter ValentinePills

    (@valentinepills)

    That’s what I did. I went in Photoshop and created new featured images with those same dimensions and uploaded them. I set the featured image and the result was still the same. ?? I guess I just can’t use this theme. If I do… I just can’t use the featured images option because it does have the option to turn that off with this theme. ?? That makes me sad a little lol

    So I try upload this image
    wp-content/uploads/2013/07/FeaturedImage_Owlesque.png

    to my wp test site with this theme installed
    https://i.imgur.com/kapt8we.png

    You could see that it doesn’t get streched like your example which I think it’s showing this ( thumbnail size from previously used theme ).
    /wp-content/uploads/2013/07/FeaturedImage_Owlesque-245x180.png

    Thread Starter ValentinePills

    (@valentinepills)

    That’s what I’m trying to say. That image was not used on a previous theme. It was used on this theme. When installed and activated this theme I noticed the featured image issue so I figured out the dimensions and I made a new featured images. I uploaded one of the new featured images i had made… which is the one you used in your example here and it did the same thing.

    Maybe I’m not understanding what you’re telling me to do to fix it. What did you? Do I need to go in to the directory folders and delete something?

    What did you? Do I need to go in to the directory folders and delete something?

    I didn’t do anything special other than upload it normally via WP upload UI.

    And please note that when dealing with images in WP, do not directly upload/delete via FTP because there are metadata associated with images kept in database too. The whole thing is taken care of when done within WP dashboard. In a case that you need to replace an image via FTP, make sure to replace it with the same exact file name.

    This is from theme function
    https://themes.trac.www.ads-software.com/browser/duena/1.0.7/functions.php#L130

    set_post_thumbnail_size( 770, 295, true ); // Normal post thumbnails
    add_image_size( 'slider-post-thumbnail', 1170, 450, true ); // Slider Thumbnail
    add_image_size( 'image_post_format', 770, 450, true ); // Image Post Format output
    add_image_size( 'related-thumb', 160, 160, true ); // Realted Post Image output

    The first line is to set thumbnail size, it’s called in index template. The other three are special sizes used elsewhere. There is no way that I can think of that this theme will produce a 245×180 image.

    So maybe there is a plugin that interferes with this ? Or maybe at the time you uploaded new version of the image, you didn’t clear browser cache so you saw the old version ?

    Thread Starter ValentinePills

    (@valentinepills)

    Thank you for all of your help. I’m not sure what or why mine won’t show up normal. I’m beyond frustrated with this so I guess I’ll just be finding a new theme. Thanks again!

    First and foremost: Love the theme. Thanks for all of your hard work.

    I’m fighting the same problem (and fairly new to WordPress). I can fix the problem without having to re-size/re-upload my images but I’m trying to understand why. With Duena 2.x the image sizes that are added are as follows (from functions.php):

    if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
    		add_theme_support( 'post-thumbnails' );
    		set_post_thumbnail_size( 750, 290, true ); // Normal post thumbnails
    		add_image_size( 'slider-post-thumbnail', 1140, 440, true ); // Slider Thumbnail
    		add_image_size( 'image_post_format', 750, 440, true ); // Image Post Format output
    		add_image_size( 'related-thumb', 160, 160, true ); // Realted Post Image output
    		add_image_size( 'portfolio-large-th', 550, 210, true ); // 2 cols portfolio image
    		add_image_size( 'portfolio-small-th', 265, 100, true ); // 4 cols portfolio image
    	}

    Note the “set_post_thumbnail_size” of 750×290. I’m assuming this directive caused the version of the image file “image001-750×290.jpg” to be created when I uploaded. This is a nice center-cropped image that I expected to appear as the featured image.

    In the extras.php the duena_post_format_image() function used to get the image file for the featured image asks for a larger size:

    $image = wp_get_attachment_image( $post_thumbnail_id, array(770, 295) );

    Note the “array(770, 295)”.

    If I change the array to ask for the specific size that “set_post_thumbnail_size” is set to crop the image_post_format to (750×290) I get the image I expected (a 750×290 image). If I don’t it appears that WordPress returns an image that is scaled to my site’s Medium Size image (300×300) as configured in the Media settings. This results in the medium size image to be scaled up to 770×290 and top-cropped resulting in a blurry image of the unimportant top portion of the photo.

    Is WordPress not doing its job here in hunting for the right size or should the theme’s usage of wp_get_attachment_image() in duena_post_format_image() be changed to line up with the set_post_thumbnail_size?

    I have a child theme so I’ll ultimately put the fix in there.

    Thanks for the help.

    A note to anyone who stumbles upon this thread:

    To apply this fix to a child theme you will need to:

    1. Create a “functions.php” file in your child theme’s root folder.
    2. Copy the “duena_post_format_image()” function from the Duena theme’s “inc\extras.php” file and paste it in your child theme’s “functions.php file and rename it “child_duena_post_format_image()”
    3. In your new “child_duena_post_format_image()” function replace all occurrences of “$image = wp_get_attachment_image( $post_thumbnail_id, array(770, 295) );” with “$image = wp_get_attachment_image( $post_thumbnail_id, array(750, 295) );”
    4. Create a “post-formats” folder in your child theme.
    5. Copy the Duena theme’s “post-formats\image.php” file to your child theme’s “post-formats” folder.
    6. Edit your child theme’s “post-formats\image.php” and replace all occurrences of “duena_post_format_image()” with “child_duena_post_format_image()”

    On last tip: remember that all images must be at least 750 pixels wide. If they’re not WP will probably use your “medium” thumbnail size.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Featured Images’ is closed to new replies.