Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#13947 closed defect (bug) (duplicate)

Featured image doesn't crop

Reported by: bi0xid Owned by: nacin
Milestone: Priority: high
Severity: major Version: 3.0
Component: Media Keywords: reporter-feedback
Focuses: Cc:


When using featured image (post-thumbnail), if you crop an image and assing it as featured image, the assigned image is the original one, not the cropped one.

Possibly related: #13404

Change History (21)

#1 @bi0xid
8 years ago

  • Keywords reporter-feedback added
  • Milestone changed from 3.0 to 3.0.1

#2 @toscho
8 years ago

  • Cc toscho added
  • Summary changed from Feautred image doesn't crop to Featured image doesn't crop

As a quick fix, use:

    array ( 150, 150 ), // size
    array ( 'class' => 'attachment-post-thumbnail' )

#3 @nacin
8 years ago

Is this a regression?

#4 @bi0xid
8 years ago

Don't know. Will look.

@toscho thanks :)

#5 follow-up: @slawrence10
8 years ago

I'm using:

add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 246, 225, true );

in functions.php and works as expected

#6 in reply to: ↑ 5 ; follow-up: @toscho
8 years ago

Replying to slawrence10:

add_theme_support() doesn’t accept a second parameter.

My last working configuration …

set_post_thumbnail_size(200, 150, TRUE);

… stopped working with WP 3.0.

So, yes, this looks like a regression.

#7 in reply to: ↑ 6 ; follow-up: @bi0xid
8 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Updating problems.

It works the same way in Media Library and Post -> Add new image -> Gallery

  • If the image is assigned as featured image, you can only crop. It assumes all sizes.
  • If the image is not assigned, you can crop it and assign the crop to All sizes, thumbnail or All except thumbnail.

I suppose it's the correct way to work with thumbnails to don't have assignment problems.

Also replying to toscho:

You can set the thumbnail size in Settings -> Media and it works. And then, to get the thumbnail or a custom thumbnail:

the_post_thumbnail();                  // without parameter -> Thumbnail
the_post_thumbnail('thumbnail');       // Thumbnail
the_post_thumbnail('medium');          // Medium resolution
the_post_thumbnail('large');           // Large resolution
the_post_thumbnail( array(100,100) );  // Other resolutions

#8 @ocean90
8 years ago

  • Milestone 3.0.1 deleted

if you think it's a bug/regression, feel free to re-open the ticket with further information.

#9 @JohnONolan
8 years ago

  • Milestone set to 3.1
  • Priority changed from normal to high
  • Severity changed from normal to major

Not sure what further information is required here? I haven't found any way to get a post thumbnail to crop since 3.0 - regardless of what $crop is set to, it always resizes as if $crop is set to false.

#10 @JohnONolan
8 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

#11 @JohnONolan
8 years ago

  • Owner set to nacin
  • Status changed from reopened to assigned

#12 @nacin
8 years ago

Is this a duplicate of #13404?

#13 @JohnONolan
8 years ago

Nope, not as far as I can tell

#14 @markjaquith
7 years ago

  • Resolution set to invalid
  • Status changed from assigned to closed

This bug needs a better description. What you did, what happened, what you expected.

#15 @JohnONolan
7 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

@markjaquith - Simplest explanation I can give is to echo the_thumbnail() in a theme file and define $crop as "true" in functions.php - the output will always be as if $crop is set to false.

To clarify:

$crop = true: fit the shortest length into specified dimensions, crop the rest. Exact thumbnail dimensions are filled. $crop = false: fit the longest length into the specified dimensions. Original aspect ratio is preserved, no exact thumbnail dimensions.

#16 @JohnONolan
7 years ago

*I've reproduced this across multiple installs and hosting environments

#17 @markjaquith
7 years ago

Are you aware that cropping is only intended to work going forward? That is, you can't (yet) use an old image and expect WordPress to crop it on the fly. Just making sure that you're testing this by uploading a NEW image, and seeing if that is cropped.

#18 @JohnONolan
7 years ago

Affirmative, have taken this into account

#19 @markjaquith
7 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

First, the issue you're reporting doesn't appear to be the issue described in this ticket. This ticket appears to be a duplicate of #13404. So I'm closing on that account

Second, I can't reproduce the issue you described related to the crop parameter:


Open a new ticket for that issue, with reproduction steps.

#20 in reply to: ↑ 7 @bi0xid
7 years ago

Adding some light to this ticket.

It was first opened because the system did not crop already uploaded files with the system editor. It's working since 3.0 See image

Second problem encountered was comment 7, working correctly too, even if the image is marked as featured.

So everything working in the original ticket.

#21 @ocean90
7 years ago

  • Milestone 3.1 deleted
Note: See TracTickets for help on using tickets.