[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
Thu Mar 7 16:24:29 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 needs-unit-    |
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by nacin):

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


Comment:

 I would suggest the following breakdown:

  * get_attached_images() — get images attached to the post. Simple wrapper
 of get_children(), as in the patch.
  * get_content_images() — fetch all images referenced in the content
  * get_post_galleries() — fetch all galleries referenced in the content

 To bring it all together:
  * get_associated_post_images() — which should also return post
 thumbnails. More or less covers #16349.

 To also cover #23593:
  * get_post_gallery() — first gallery referenced in the content
  * get_content_image() — first image referenced in the content

 Let's avoid the get_tag_regex() abstraction for now, I am thinking.

 Also, the content and gallery extraction functions need unit tests like
 whoa.

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


More information about the wp-trac mailing list