<?php if ($pinthis_video_url) { ?>
<div class="preview">
<div class="thumb
<?php
if ($pinthis_video_aspect_ratio == '16:9') {
$pinthis_video_height = 181;
echo ' ar-16-9';
} elseif ($pinthis_video_aspect_ratio == '4:3') {
echo ' ar-4-3';
$pinthis_video_height = 177;
}
?>
<?php
if (strpos($pinthis_video_url, 'youtube') > 0 || strpos($pinthis_video_url, 'vimeo') > 0) {
echo ' remote-video';
}
?>
">
<?php
if (strpos($pinthis_video_url, 'youtube') > 0) {
echo wp_oembed_get($pinthis_video_url, array('width' => $pinthis_video_width, 'rel' => 0, 'showinfo' => 0, 'wmode' => 'opaque'));
} elseif (strpos($pinthis_video_url, 'vimeo') > 0) {
echo wp_oembed_get($pinthis_video_url, array('width' => $pinthis_video_width));
} else {
// get poster
$img = '';
if (has_post_thumbnail()) {
$img = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'pt-pinbox');
}
if ($img[0] != '') {
$pinthis_video_poster = $img[0];
} else {
$pinthis_video_poster = '';
}
// check video format
$pinthis_video_extension = substr($pinthis_video_url, strrpos($pinthis_video_url, '.') + 1);
$pinthis_video_format = strtolower($pinthis_video_extension);
$pinthis_supported_video_formats = array('mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv');
if (in_array($pinthis_video_format, $pinthis_supported_video_formats)) {
echo do_shortcode('[video width="' . $pinthis_video_width . '" height="' . $pinthis_video_height . '" src="' . $pinthis_video_url . '" poster="' . $pinthis_video_poster . '"][/video]');
} else { ?>
<img src="<?php echo pinthis_get_skin_src(); ?>/images/no-video.png" width="321" height="321" alt="<?php the_title(); ?>">
<?php }
}
?>
</div>
</div>
<?php } ?>