I'm getting all videos using the function below and it's working fine. Now I want to get the videos Poster Image (Thumbnail Image) from that video. How can I get the video Image as thumbnail? I've also tried to get thumbnail by this function but It's not working
$page_id = 659;
$page_data = get_page( $page_id );
if (has_post_thumbnail( $page_data->ID ) ){ ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $page_data->ID ), 'single-post-thumbnail' ); ?>
<img src="<?php echo $image[0]; ?>" width="200" height="212" />
<?php }?>
I'm getting all videos by this function
$args = array
(
'post_type' => 'attachment',
'post_mime_type' => 'video',
'order' => 'DESC',
'orderby' => 'post_date',
'posts_per_page' => -1
);
$videoFiles = get_posts($args);
foreach ($videoFiles as $file) {
}
My post object:
WP_Post Object
(
[ID] => 670
[post_author] => 1
[post_date] => 2013-06-26 10:55:51
[post_date_gmt] => 2013-06-26 10:55:51
[post_content] => Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries,
[post_title] => Strike Back
[post_excerpt] => Composer
[post_status] => inherit
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] => columbia4x3
[to_ping] =>
[pinged] =>
[post_modified] => 2013-06-26 10:55:51
[post_modified_gmt] => 2013-06-26 10:55:51
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://host.com/wp-content/uploads/2013/06/Columbia4x3.mov
[menu_order] => 0
[post_type] => attachment
[post_mime_type] => video/quicktime
[comment_count] => 0
[filter] => raw
)
foreach
use the same thumbnail logic using$file->post_parent
as the page ID.