Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 23641)
+++ wp-includes/functions.php	(working copy)
@@ -3887,6 +3887,26 @@ function wp_checkdate( $month, $day, $year, $source_date ) {
 }
 
 /**
+ * Return RegEx body to liberally match an opening HTML tag that:
+ * 1. Is self-closing or
+ * 2. Has no body but has a closing tag of the same name or
+ * 3. Contains a body and a closing tag of the same name
+ *
+ * Note: this RegEx does not balance inner tags and does not attempt to produce valid HTML
+ *
+ * @since 3.6.0
+ *
+ * @param string $tag An HTML tag name. Example: 'video'
+ * @return string
+ */
+function get_tag_regex( $tag ) {
+	if ( empty( $tag ) )
+		return;
+
+	return sprintf( '(<%1$s[^>]*(?:/?>$|>[\s\S]*?</%1$s>))', tag_escape( $tag ) );
+}
+
+/**
  * Load the auth check, for monitoring whether the user is still logged in
  *
  * @since 3.6.0
Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 23641)
+++ wp-includes/media.php	(working copy)
@@ -1542,3 +1542,102 @@ function wp_enqueue_media( $args = array() ) {
 
 	do_action( 'wp_enqueue_media' );
 }
+
+/**
+ * Retrieve images attached to the passed post
+ *
+ * @since 3.6.0
+ *
+ * @param int $post_id  Post ID
+ * @return array Found image attachments
+ */
+function get_post_images( $post_id = 0 ) {
+	$post = empty( $post_id ) ? get_post() : get_post( $post_id );
+	if ( empty( $post ) )
+		return;
+
+	$children = get_children( array(
+		'post_parent' => $post->ID,
+		'post_type' => 'attachment',
+		'post_mime_type' => 'image',
+		'posts_per_page' => -1,
+		'orderby' => 'menu_order',
+		'order' => 'ASC'
+	) );
+
+	if ( ! empty( $children ) )
+		return $children;
+}
+
+/**
+ * Check the content blob for images
+ *
+ * @param string $content A string which might contain image data.
+ * @param boolean $remove Whether to remove the found data from the passed content.
+ * @return string The found data
+ */
+function get_content_images( &$content, $remove = false ) {
+	$src = '';
+	$srcs = array();
+	$matches = array();
+	$match = array();
+
+	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $match, PREG_SET_ORDER ) && ! empty( $match ) ) {
+		foreach ( $match as $i => $shortcode ) {
+			if ( 'gallery' === $shortcode[2] ) {
+				$count = 1;
+				if ( $remove )
+					$content = str_replace( $shortcode[0], '', $content, $count );
+
+				$gallery = do_shortcode_tag( $shortcode );
+				preg_match_all( '#src=[\'"](.+?)[\'"]#is', $gallery, $src, PREG_SET_ORDER );
+				if ( ! empty( $src ) ) {
+					foreach ( $src as $s )
+						$srcs[] = $s[1];
+				}
+			}
+		}
+	}
+
+	if ( preg_match_all( '#' . get_tag_regex( 'img' ) . '#i', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) {
+		foreach ( $matches as $tag ) {
+			$count = 1;
+			if ( $remove )
+				$content = str_replace( $tag[0], '', $content, $count );
+
+			preg_match( '#src=[\'"](.+?)[\'"]#is', $tag[1], $src );
+			if ( ! empty( $src[1] ) )
+				$srcs[] = $src[1];
+		}
+	}
+
+	return array_values( array_unique( $srcs ) );
+}
+
+/**
+ * Return the found gallery / image data for the passed post
+ *
+ * @since 3.6.0
+ *
+ * @param int $id Optional. Post ID
+ */
+function get_the_images( $id = 0 ) {
+	$post = empty( $id ) ? get_post() : get_post( $id );
+	if ( empty( $post ) )
+		return '';
+
+	$srcs = array();
+
+	$data = get_content_images( $post->post_content );
+	if ( ! empty( $data ) )
+		$srcs = array_merge( $srcs, $data );
+
+	$images = get_post_images( $post->ID );
+	if ( empty( $images ) )
+		return $srcs;
+
+	foreach ( $images as $image )
+		$srcs[] = wp_get_attachment_url( $image->ID );
+
+	return array_values( array_unique( $srcs ) );
+}
\ No newline at end of file
