Opened 2 years ago

Last modified 3 weeks ago

#17262 new defect (bug)

wp_get_attachment_thumb_file is always false

Reported by: lonnylot Owned by:
Priority: normal Milestone: 3.6
Component: Media Version: 3.0
Severity: normal Keywords: 3.3-early has-patch
Cc: michael.d.beckwith@…

Description (last modified by DrewAPicture)

The issue is that on line 3863 we always search for $imagedata['thumb'] and it never exists. Instead we have $imagedata['thumbnail']. This always exists.

Attachments (4)

post.diff (302 bytes) - added by lonnylot 2 years ago.
17262.diff (597 bytes) - added by lonnylot 2 years ago.
wp-includes/post.php diff
17262.2.diff (1.0 KB) - added by wonderboymusic 4 months ago.
post.2.diff (726 bytes) - added by JoshuaAbenazer 3 months ago.
This one first checks for the "fall back to the old thumbnail" and if that returns false then goes ahead and checks according to the revised array

Download all attachments as: .zip

Change History (16)

  • Keywords has-patch removed

Please submit patches as svn diffs. Tutorials can be found on the trac homepage.

Version 0, edited 2 years ago by scribu (next)

wp-includes/post.php diff

Sorry for the delay! Added the correct diff off of trunk rev. 18191

  • Version changed from 3.2 to 3.0

So does wp_get_attachment_thumb_file() ever work? That function should probably be deprecated in favor of the various other functions now.

As far as I can tell not unless you add a custom image type called 'thumb'

@nacin is right, deprecate +1.

  • Keywords needs-patch 3.3-early added
  • Milestone changed from Awaiting Review to Future Release
  • Cc michael.d.beckwith@… added
  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 3.6

17262.2.diff updates wp_get_attachment_thumb_file() so it works in trunk. The previous patch did not have current code in mind. It's not immediately obvious to me what wp_get_attachment_thumb_file() and wp_get_attachment_thumb_url() would be deprecated in favor of.

'thumb' is the old-style thumbnail, prior to proper intermediate sizes ('thumbnail' / 'medium' / 'large').

wp_get_attachment_thumb_url() does return the newer 'thumbnail' if it exists, and falls back to wp_get_attachment_thumb_file() if it does not.

You can see a bit of code history in image_downsize(): "fall back to the old thumbnail" in a code comment.

Not sure what _file() should return in a deprecated situation. _url() is basically the old-school form of wp_get_attachment_image_src( $size = 'thumbnail' ), which returns array( $src, $width, $height ). Which is kind of lame.

So, perhaps they can both be updated to work on 'thumbnail', and then left, as wp_get_attachment_thumb_url() is definitely easier, nicer, and more obvious to use than wp_get_attachment_image_src()['url'], and according to MarkJaquith, is widely used by plugins (probably for that reason).

Last edited 3 months ago by SergeyBiryukov (previous) (diff)

#23556 was marked as a duplicate.

This one first checks for the "fall back to the old thumbnail" and if that returns false then goes ahead and checks according to the revised array

#10492 was marked as a duplicate.

  • Description modified (diff)
Note: See TracTickets for help on using tickets.