Get all images in post and comments like Twitter before post title

Getting all the images from the post, and adding them to the top of the post is relatively easy. You can do something like this: (Note, this is just a code example. I’m not 100% what you are looking for. Hopefully this is enough to get you started.)

function getImagesInThisPost() {
    global $post, $posts;
    //find all the <img>'s in the post
    $output = preg_match_all(
        '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', 
        $post->post_content, //from the post content
        $matches
    );

    //loop throuhg all the images we found, and put them on the page
    foreach($matches[1] as $single){
        echo "<img src=\"{$single}\">";
    } 
}