Forum

Thread tagged as: Question, Api

Youtube thumbnail

I'm using Flexslider 2 for my carousel. There is an option to have thumbnails for navigation.

When the youtube link is processed in the perch form the array that is generated from the api includes thumbnail links e.g.

"thumbnails": { "default": { "url": "https://i.ytimg.com/vi/T1R-d1ejlio/default.jpg", "width": 120, "height": 90 }, "medium" etc....

Is there a way I could access that information in my template?

The format would be something like

<li data-thumb="<perch:content id="video" get thumbnail info here............. />">
    <perch:content id="video" type="youtube" label="YouTube URL" enablejsapi="1" rel="0" output="embed" />
</li>

The only other option I can think of would be to use javascript to add the data-thumb afterwards, but I'm conscious now of not making unnecessary api calls.

edit THE ANSWER:

Read the perch youtube docs. output="thumbnail"

<li data-thumb="<perch:content id="video" type="youtube" label="YouTube URL" output="thumb" />">
    <perch:content id="video" type="youtube" label="YouTube URL" enablejsapi="1" rel="0" output="embed" />
</li>
Russell Gooday

Russell Gooday 0 points

  • 4 years ago

thumbnail sizes don't appear to be working

tried the following

<li data-thumb="<perch:content id="video" type="youtube" label="YouTube URL" thumb_w="320" thumb_h="180" output="thumb" />">

but only get 120x90 thumbnail.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you re-saved the content since changing the template?

It's a good question Drew, given my last thread, but yes

Drew McLellan

Drew McLellan 2638 points
Perch Support

The thumbnail size should match the player size. I'm actually not sure why those options exist, or how they're implemented.

Ok

They do show up in the debug when I save changes but have the default sizes 120x90. Would be nice to have access to the larger thumbnail. Medium which is 320 x 180

Have done a workaround in CSS so not too much of an issue for now.

Thanks