Site icon Hip-Hop Website Design and Development

Get post attached image to display in admin dashboard

I’ve searched awhile for a solution on how to get the attached image in the post’s editor to display within the dashboard but I am running into an issue. I’ve seen how to do this and can do this with the thumbnail:

function foo_attached_image( $post_ID ) {
    $post_thumbnail_id = get_post_thumbnail_id( $post_ID );
    if ( $post_thumbnail_id ) {
        $post_thumbnail_img = wp_get_attachment_image_src( $post_thumbnail_id );
        return $post_thumbnail_img[0];
    }
}

but the thumbnail is already being used and has a different size then I need. When I try to modify my function that includes manage posts custom column to only pull the image I cant seem to get it to work with wp_get_attachment_url():

function attached_image_content( $column_name, $post_ID ) {
    if ( $column_name == 'foobar' ) {
        $post_attached_image = wp_get_attachment_url( $post_ID );
        if ( $post_attached_image ) {
            echo '<img style="width:100%;" src="' . $post_attached_image . '" />';
        }
    }
}
add_action( 'manage_cpt_posts_custom_column', 'attached_image_content', 10, 2 );

and I’ve tried with wp_get_attachment_image_src() as $post_attached_image = wp_get_attachment_image_src( $post_ID, 'medium' ); with still no go. If I use get_intermediate_image_sizes() I can get the array of everything attached but for some reason I cannot seem to get whatever image was loaded in the editor to display. What is the appropriate way to render the first uploaded image excluding the thumbnail so it will be displayed in the dashboard?