Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#24188 closed defect (bug) (fixed)

Post Formats: get_the_post_format_image doesn't return the requested size

Reported by: kovshenin's profile kovshenin Owned by: markjaquith's profile markjaquith
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.6
Component: Post Formats Keywords: has-patch
Focuses: Cc:

Description

The new get_the_post_format_image function accepts an $attached_size argument, but the value is ignored for the following cases:

  • Image meta has a caption shortcode and image HTML
  • Image meta is an image URL
  • Image meta is an image HTML string
  • Image meta is empty, but content contains image HTML

The only way this seems to work as expected is when the get_attached_images-way and when the meta is numeric.

Attachments (2)

24188.diff (3.5 KB) - added by kovshenin 12 years ago.
24188.2.diff (3.5 KB) - added by kovshenin 12 years ago.

Download all attachments as: .zip

Change History (5)

@kovshenin
12 years ago

#1 @kovshenin
12 years ago

  • Keywords has-patch added

Related to #23945 and #24002 but not duplicates. This has nothing to do with the way results are cached.

24188.diff introduces a new function to get an attachment ID out of HTML containing an image. This function is then used in get_the_post_format_image where applicable. Somewhat regex-heavy.

@kovshenin
12 years ago

#2 @kovshenin
12 years ago

Refreshed in 24188.2.diff:

  • Uses backreference to match the closing single or double quote in img_html_to_post_id and get_the_post_format_image (see also #24225)
  • Use $attr in img_html_to_post_id instead of $src which is undefined

#3 @markjaquith
11 years ago

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In 24240:

Return the requested image size in get_the_post_format_image()

props kovshenin. fixes #24188.

Note: See TracTickets for help on using tickets.