我正在使用下面的功能获取所有视频,它工作正常。现在我想从视频中获取视频海报图像(缩略图)。如何将视频图像获取为缩略图?我也尝试通过此功能获取缩略图,但它不起作用
$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 }?>
我通过此功能获取所有视频
$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) {
}
我的帖子对象:
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
)