Skip to content

Instantly share code, notes, and snippets.

@anointed
Created April 30, 2013 11:00
Show Gist options
  • Save anointed/5488029 to your computer and use it in GitHub Desktop.
Save anointed/5488029 to your computer and use it in GitHub Desktop.
Our EVS Thumbnail API works over GET or POST it really doesn't matter There is actually a way of pulling all 10 thumbnails per video and also the splash image for each video via a url, one in standard form, and one in pretty.
if(get_field('evs_oembed_video_url')) {
$evs_location = get_option('evs_location');
$api = $evs_location.'/api.php';
$the_evs_page_url = get_field('evs_oembed_video_url');
$video_thumb_info = wp_remote_post($api, array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'cookies' => array(),
'body' => array(
'page_url' => $the_evs_page_url,
'method' => 'public-file-images'
)
));
$video_thumb_info = json_decode($video_thumb_info['body']);
if(is_object($video_thumb_info) && $video_thumb_info->success == true) {
$thumb = $video_thumb_info->thumbnail;
echo '<img src='.$thumb.'>';
}
}
Here is a "standard" url:
http://wphotline.com/evs/api.php?method=public-file-images&page_url=http://wphotline.com/evs/evs-vs-youtube-thumbnails-oembed-nonresponsive/
Here is the output from the above 'standard'url:
{"success":true,"splash":"http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-0.jpg","thumbnails":["http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-0.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-1.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-2.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-3.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-4.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-5.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-6.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-7.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-8.jpg","http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-9.jpg"],"thumbnail":"http:\/\/evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com\/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-0.jpg"}
Here is a 'pretty' url
http://wphotline.com/evs/api.php?responseType=pretty&method=public-file-images&page_url=http://wphotline.com/evs/evs-vs-youtube-thumbnails-oembed-nonresponsive/
Here is the output from the above 'pretty' url
Array
(
[success] => 1
[splash] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-0.jpg
[thumbnails] => Array
(
[0] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-0.jpg
[1] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-1.jpg
[2] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-2.jpg
[3] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-3.jpg
[4] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-4.jpg
[5] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-5.jpg
[6] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-6.jpg
[7] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-7.jpg
[8] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-8.jpg
[9] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-9.jpg
)
[thumbnail] => http://evp3-5100afa6ad386-8eb4309c974ba457b50745c630e3be0e.s3.amazonaws.com/EVS-vs.-Youtube-thumbnails--oEmbed-=-NonResponsive-thumbnail-0.jpg
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment