diff --git wp-includes/functions.php wp-includes/functions.php
index e0b8cb8..c61c7ec 100644
--- wp-includes/functions.php
+++ wp-includes/functions.php
@@ -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
diff --git wp-includes/media.php wp-includes/media.php
index 9ef641c..b282bcf 100644
--- wp-includes/media.php
+++ wp-includes/media.php
@@ -1544,3 +1544,174 @@ 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_attached_images( $post_id = 0 ) {
+	$post = empty( $post_id ) ? get_post() : get_post( $post_id );
+	if ( empty( $post ) )
+		return array();
+
+	$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;
+
+	return array();
+}
+
+/**
+ * Retrieve images attached to the passed post
+ *
+ * @since 3.6.0
+ *
+ * @param int $post_id  Post ID
+ * @return array Found image attachments
+ */
+function get_attached_image_srcs( $post_id = 0 ) {
+	$children = get_attached_images( $post_id );
+	if ( empty( $children ) )
+		return array();
+
+	$srcs = array();
+	foreach ( $children as $attachment )
+		$srcs[] = wp_get_attachment_url( $attachment->ID );
+
+	return $srcs;
+}
+
+/**
+ * Check the content blob for images
+ *
+ * @since 3.6.0
+ *
+ * @param string $content A string which might contain image data.
+ * @param boolean $remove Whether to remove the found data from the passed content.
+ * @param int $limit Optional. The number of galleries to return
+ * @return string The found data
+ */
+function get_content_images( &$content, $remove = false, $limit = 0 ) {
+	$src = '';
+	$srcs = array();
+	$matches = array();
+
+	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];
+				if ( $limit > 0 && count( $srcs ) >= $limit )
+					break;
+			}
+		}
+	}
+
+	return array_values( array_unique( $srcs ) );
+}
+
+/**
+ * Check the content blob for images and return the first
+ *
+ * @since 3.6.0
+ *
+ * @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_image( &$content, $remove = false ) {
+	$srcs = get_content_images( $content, $remove, 1 );
+	return reset( $srcs );
+}
+
+/**
+ * Check the content blob for galleries and return their image srcs
+ *
+ * @since 3.6.0
+ *
+ * @param string $content A string which might contain image data.
+ * @param boolean $remove Optional. Whether to remove the found data from the passed content.
+ * @param int $limit Optional. The number of galleries to return
+ * @return array A list of galleries, which in turn are a list of their srcs in order
+ */
+function get_content_galleries( &$content, $remove = false, $limit = 0 ) {
+	$src = '';
+	$galleries = array();
+	$matches = array();
+
+	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) && ! empty( $matches ) ) {
+		foreach ( $matches as $shortcode ) {
+			if ( 'gallery' === $shortcode[2] ) {
+				$srcs = array();
+				$data = array();
+				$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];
+				}
+				// the function will eventually return more data about the gallery
+				$data['src'] = array_values( array_unique( $srcs ) );
+				$galleries[] = $data;
+				if ( $limit > 0 && count( $galleries ) >= $limit )
+					break;
+			}
+		}
+	}
+
+	return $galleries;
+}
+
+/**
+ * Retrieve galleries from the passed post's content
+ *
+ * @since 3.6.0
+ *
+ * @param int $post_id A string which might contain image data.
+ * @return array A list of galleries, which in turn are a list of their srcs in order
+ */
+function get_post_galleries_images( $post_id = 0 ) {
+	$post = empty( $post_id ) ? clone get_post() : get_post( $post_id );
+	if ( empty( $post ) )
+		return array();
+
+	$data = get_content_galleries( $post->post_content );
+	return wp_list_pluck( $data, 'src' );
+}
+
+/**
+ * Check the content blob for galleries and return the image srcs for the first found gallery
+ *
+ * @since 3.6.0
+ *
+ * @param int $post_id A string which might contain image data.
+ * @return array A list of a gallery's image srcs in order
+ */
+function get_post_gallery_images( $post_id = 0 ) {
+	$post = empty( $post_id ) ? clone get_post() : get_post( $post_id );
+	if ( empty( $post ) )
+		return array();
+
+	$data = get_content_galleries( $post->post_content, false, 1 );
+	return reset( wp_list_pluck( $data, 'src' ) );
+}
\ No newline at end of file
