Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#27273 closed defect (bug) (invalid)

thumbnail size aliases returning mixed results

Reported by: jadpm Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: Post Thumbnails Keywords:
Focuses: Cc:


Not sure if this has been discussed elsewhere, I could not find it.

In the Post thumbnail documentation it is stated that "thumb" and "post-thumbnail" are both aliases of the "thumbnail" size. But

get_the_post_thumbnail( $id, "thumb" );


get_the_post_thumbnail( $id, "thumbnail" );

produce different results. "thumbnail" returns the img tag filled with the resized image src and correct width and height attributes, while "thumb" returns the img tag with the full image src and cropped with and height attributes.

My take is that the aliases are not really aliases in a lot of the media related functions. For example, in wp-includes/media.php line 46 inside image_constrain_size_for_editor() only "thumb" is used as alias. Most of the times, only "thumbnail" is being used.

Tested with the latest trunk version coming from the beta tested plugin and TwentyTwelve.

Change History (5)

#2 @jeremyfelt
8 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 2.5

When a request to get_the_post_thumbnail( $id, 'thumb' ) is made, it initiates this:

  • wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '')
  • wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false)
  • image_downsize($id, $size = 'medium')

In image_downsize(), we look for an intermediate size of thumb via image_get_intermediate_size(), which checks post meta for all sizes associated with the attachment. By default, a size exists for thumbnail, not thumb, and it returns false.

The next block that would catch it is elseif ( $size == 'thumbnail' ). This falls back to the default thumbnail size. Instead, we move on and assign the full image URL.

I'm not confident yet, but we may be able to resolve this in image_downsize().

This seems to point to [7135], which isn't attached to a ticket but occurred during the 2.5 milestone and shifted the thumb/thumbnail name.

#3 @nacin
8 years ago

From what I recall: thumb, thumbnail, and post-thumbnail are three totally different sizes. thumb is legacy, thumbnail is the current thumbnail size, and post-thumbnail is a theme's post thumbnail size.

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.

8 years ago

#5 @chriscct7
6 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

Per comment:3 closing as invalid

Note: See TracTickets for help on using tickets.