[wp-trac] [WordPress Trac] #20205: Add the ability to filter wp_get_attachment_image()

WordPress Trac wp-trac at lists.automattic.com
Sun Aug 5 22:27:31 UTC 2012


#20205: Add the ability to filter wp_get_attachment_image()
------------------------------------+------------------------------
 Reporter:  helgatheviking          |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Media                   |     Version:  3.4
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------------

Comment (by helgatheviking):

 my post.php.patch is minimally intrusive.  adding one more argument
 shouldn't break anything.

 i'd agree that a wp_get_attachment_image_src filter should be inside the
 wp_get_attachment_image_src function, but that function is currently
 structured such that if you are getting the attachment_image for a non-
 image, you pretty much fail right away b/c if you don't get an image back
 from image_downsize(), you get kicked to looking for an icon.  and there's
 no way to return an image from an attachment's postmeta, b/c
 image_downsize() immediately returns false if the attachment itself isn't
 an image.

 i like your solution too though. it should be there, but for my use case,
 it is a little late and would be redundant.  but a filter for
 wp_get_attachment_image_src definitely gives the most control.  just a
 matter of where it should be.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20205#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list