WordPress.org

Support

Support » How-To and Troubleshooting » attachment images getting cropped vertically

attachment images getting cropped vertically

  • I am trying to setup my site with wordpress (and weaver 1.7) its all going pretty smoothly after few messed up exercises.

    My problem is that single attachment pages get images cropped into a thin slice.

    For example:
    http://machinista.com/wp2/?p=4
    on page above both single images, featured image and gallery images act as predicted BUT clicking on any image will open the single image in weird horizontal panorama crop.
    for example:

    http://machinista.com/wp2/?attachment_id=6

    or

    http://machinista.com/wp2/?attachment_id=16

    I thought that I fatally changed some css and re installed the whole wp setup into new directory but still get this issue. As you can see from 2 examples the height isn’t even the same (though image were added at different time). Can anyone hint me where the page gets the info for the crop?

    Please ignore the general appearance – all color and logo choices are waiting to be put in. The failing functionality makes me go nuts.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Did some more testing. The cropping happens in the uploading of the image.
    for example when I attach an image that is

    1428×699

    wordpress creates folowing images:

    image_1280x626.jpg
    (Large – porportianally same and follows my max ‘large’ preset of 1280×720)

    image_1280x320x156.jpg
    (thumbnail -proportionally same and follows my thumbnail rule -max 320×180)

    image_480x234.jpg
    (medium, again follows logical rules)

    and then the mysterious

    image_900x100.jpg

    This is the header image size – but why does it get used on the attachment page?

    I am having exactly this same problem; the uploaded images are in 4 sizes, with one cropped to header width. No matter which size I choose in the media panel the ‘header crop’ configuration is used.

    must be something in the functions that I’ve done. I’m using a child theme with twentyten.

    any suggestions?

    I’ve done a bunch of testing and discovered that the ‘mysterious’ 4th crop is always there provided the image is either larger in width or height than the header size.

    That wouldn’t matter except that ‘Featured Image’ insists on using this cropped image.

    I figured it out, for twentyten at least. In ‘functions’ on line 122 (ver. 1.2) is the line that calls the header as a post_thumbnail:

    set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

    I created a child theme with this function:

    // remove auto-cropping to header size
    function remove_twentyten_autocrop() {
    	set_post_thumbnail_size( 400, 400, false );
    }
    	add_action ( 'after_setup_theme', 'remove_twentyten_autocrop', 11);

    You can set the size to whatever suits your theme. The ‘false’ parameter sets the crop to proportional, rather than a hard crop.

    If you are not using a child theme you can just comment the line out.

    more info here: http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘attachment images getting cropped vertically’ is closed to new replies.