[wp-trac] [WordPress Trac] #24060: Post formats: `get_the_post_format_image()` splitting content doesn't work when "intermediate_image_sizes" result is empty

WordPress Trac noreply at wordpress.org
Fri Apr 12 16:32:49 UTC 2013


#24060: Post formats: `get_the_post_format_image()` splitting content doesn't work
when "intermediate_image_sizes" result is empty
--------------------------+--------------------------
 Reporter:  lancewillett  |       Type:  defect (bug)
   Status:  new           |   Priority:  normal
Milestone:  3.6           |  Component:  Post Formats
  Version:                |   Severity:  normal
 Keywords:  needs-patch   |
--------------------------+--------------------------
 {{{get_the_post_format_image()}}} splits out an image from post content,
 to avoid duplicating it when a theme choose to output split content.

 Unfortunately, not all WP installs will have "default" or "expected" image
 sizes, like 'thumbnail', 'medium', 'large' etc.

 For example, on WordPress.com this call results in an empty array:
 {{{$sizes = get_intermediate_image_sizes();}}}

 I think to improve the content parsing two improvements can be made:

 1. Move {{{get_attachment_link( $media->ID )}}} out of the foreach loop
 for {{{$sizes}}} -- that URL will be the same for each size, it's just the
 permalink to the attachment page
 2. Add the "original" image source path to the {{{$urls}}} array, which is
 the image path with no size information. The original uploaded file path
 can then be used to parse out images from the main content even if the
 expected size list is empty.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24060>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list