[wp-trac] [WordPress Trac] #22960: Add functions to extract images from content, attached to post, [gallery], or arbitrary string

WordPress Trac noreply at wordpress.org
Sat Feb 23 00:55:40 UTC 2013


#22960: Add functions to extract images from content, attached to post, [gallery],
or arbitrary string
-----------------------------------+-----------------------
 Reporter:  kcssm                  |       Owner:
     Type:  defect (bug)           |      Status:  reopened
 Priority:  normal                 |   Milestone:  3.6
Component:  Media                  |     Version:  3.5
 Severity:  normal                 |  Resolution:
 Keywords:  needs-codex has-patch  |
-----------------------------------+-----------------------
Changes (by wonderboymusic):

 * keywords:  needs-codex => needs-codex has-patch


Comment:

 attachment:22960.diff provides utility functions to get all image srcs in
 post_content and / or images attached to the post plus image src(s) from
 gallery shortcode(s)

 Introduces `get_content_images( &$content, $remove = false )` which will
 assemble `[gallery]`s and read `<img>`s, extract their srcs, optionally
 remove them from the content, and return them in a unique array.

 Introduces `get_the_images()` which assembles a unique list of every image
 in the post's content retrieved via `get_content_images()` + all of the
 images attached to the post, displayed or not

 Introduces `get_post_images()` which retrieves WP_Post objects for all
 images attached to the post


 If more or different functionality is needed / wanted, let's iterate!

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


More information about the wp-trac mailing list