Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2010-10-12 20:50:59
- curiouz
- Member
- Registered: 2006-06-20
- Posts: 56
vimeo thumbnail
I want to add some Vimeo video’s to my txp site. I’ve decided I want to store the information of each video’s in textpattern links.
In the link url field I’ve stored the id of the vimeo vid.
With the vimeo api I’m trying to dynamically get the thumbnail for these vids, this is function to get the thumb from the api:
function getVimeoInfo($id, $info = 'thumbnail_medium') {
if (!function_exists('curl_init')) die('CURL is not installed!');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://vimeo.com/api/v2/video/$id.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = unserialize(curl_exec($ch));
$output = $output[0][$info];
curl_close($ch);
return $output;
}
And this is my link form:
<a href="http://vimeo.com/moogaloop.swf?clip_id=
<txp:php>
global $link;
$link = link_url();
echo $link;
</txp:php>" rel="shadowbox;width=640;height=480;player=swf"><div id="video_plaatje" style="background:url(
<txp:php>
echo getVimeoInfo('$link');
</txp:php>
) no-repeat 0px center;width:120px;height:68px;">
$link is parsed in the href. But not in the getVimeoInfo function… When I put in an existing vimeo ID, instead of $link, a thumbnail does show…
PLEASE HELP!
Offline
#2 2010-10-12 21:00:15
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: vimeo thumbnail
Can I ask why you don’t just use <txp:link_url />
? In the href attribute I mean. And what exactly should be the output of the second piece of PHP code? I’m not good at PHP but trying to find a way to do it with Txp tags ;)
Last edited by els (2010-10-12 21:04:11)
Offline
Re: vimeo thumbnail
Use this:
<txp:php>
global $link;
echo getVimeoInfo('$link');
</txp:php>
Globals have to be declared in every <txp:php>
block.
Offline
Offline
#5 2010-10-13 12:57:35
- curiouz
- Member
- Registered: 2006-06-20
- Posts: 56
Re: vimeo thumbnail
Works like a charm! Thanks a bunch :)
Offline
Re: vimeo thumbnail
Hi guys!! Sorry to ask this but I’m a newbie and this is totally what I was looking for.
I’d like to make a gallery of vimeo videos but I don’t know what’s the correct workflow to do this.
I’d like the article image of an article to be the vimeo thumbnail and then on the article place the title of the article, the vimeo player, the body of the article and the excerpt. What would be the best practice to achieve this?
Any help is welcome. Thanks in advance.
Offline
Pages: 1