Reputation: 1
I have a URL Shortener (Yourls.org) installed on a domain. The index.php contains the following code:
<html>
<head>
<style type="text/css">
html,body{
height: 100%;
min-height: 100%;
margin: 0;
padding: 0;
background-color: #000;
}
</style>
</head>
<body>
<iframe src="//player.vimeo.com/video/<?php echo filter_input(INPUT_GET, 'clipid', FILTER_SANITIZE_NUMBER_INT); ?>?server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1&autoplay=1" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<?php endif; ?>
</body>
</html>
The aim is to use Vimeo to store the clip ID in the link to be resolved after the shortened link (this will look like this: http://domain/?clipid=8374896345). A black screen is simply displayed if the link to be resolved does not correspond to the above, or only the video as an embedded video from Vimeo.
The problem now is that the thumbnail is not loaded by Vimeo when sending the short link.
Which code do I have to add in the index.php (and where), so that the thumbnail is loaded anyway.
I have seen a similar question here: Get img thumbnails from Vimeo? But i can't get the right code...
Can someone help me?
Upvotes: 0
Views: 535
Reputation: 3018
I think you're complicating your question with your URL shortener, that or I don't understand your usecase. Regardless, you can use Vimeo's oEmbed implementation to retrieve the video's embed code and thumbnail image link. To do so, simply pass the video's full URL to the oEmbed uri:
https://vimeo.com/api/oembed.json?url=https://vimeo.com/76979871
This also has the advantage of returning you a valid and functional embed code, instead of constructing the embed code as you described. oEmbed docs are found here: https://developer.vimeo.com/api/oembed/videos
Upvotes: 0