Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 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)

comment:1 @bi0xid5 years ago

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

comment:2 @toscho5 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' )

comment:3 @nacin5 years ago

Is this a regression?

comment:4 @bi0xid5 years ago

Don't know. Will look.

@toscho thanks :)

comment:5 follow-up: @slawrence105 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

comment:6 in reply to: ↑ 5 ; follow-up: @toscho5 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.

comment:7 in reply to: ↑ 6 ; follow-up: @bi0xid5 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

comment:8 @ocean905 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.

comment:9 @JohnONolan4 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.

comment:10 @JohnONolan4 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:11 @JohnONolan4 years ago

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

comment:12 @nacin4 years ago

Is this a duplicate of #13404?

comment:13 @JohnONolan4 years ago

Nope, not as far as I can tell

comment:14 @markjaquith4 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.

comment:15 @JohnONolan4 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.

comment:16 @JohnONolan4 years ago

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

comment:17 @markjaquith4 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.

comment:18 @JohnONolan4 years ago

Affirmative, have taken this into account

comment:19 @markjaquith4 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.

comment:20 in reply to: ↑ 7 @bi0xid4 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.

comment:21 @ocean904 years ago

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