Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Is anyone else having troubles with trying to capture thumbnails from embed video provider?
Embed video is: http://www.website.com/embed/555/video_title
And video its self is very similar http://www.website.com/watch/555/video_title
The 555 is the video id from the video provider.
I trying to get thumbnail with:
function video_embed_website_handle_thumbnail($url) {
$id = _video_embed_website_get_video_id($url);
$thumbnail = 'http://www.website.com/watch/'.$id;
return array(
'id' => $id,
'url' => $thumbnail,
);
}
function _video_embed_website_get_video_id($url) {
$matches = array();
$matches = _video_embed_website_split("/", $url);
$index = count($matches) - 2;
if ($matches[$index]) {
return $matches[$index];
}
return FALSE;
}
Any input would be sincerely appreciated!
THANKS!
Comments
Comment #1
JohnnyW CreditAttribution: JohnnyW commented$thumbnail = "http://cdn1.image.website.webcdn.com/555/666/$url_id/original/8.jpg";
Okay, if I use this, I can get thumbnail from their content dev network servers....
See the $url_id, which is $index = count($matches) - 3;
That is to say, 3rd position from .com is a url position
Now, if I try to use my other $index =count($matches) -2, and the other for -1, these inserted variables, $id for -2 and $name for -1 positions after the .com, these DO NOT work and I get a failure to getting the thumbnail.
Yet, I NEED to use these variables, because the url is dynamic, and these numbers keep changing from like 555/666 to 342/990 or like 253/3049.
Here is the template for those variables:
I have each different function named uniquely, except -1, which is this code for the template:
ANY suggestions would be awesome.
Thanks!
Comment #2
gfed CreditAttribution: gfed commentedWouldn't advancing the index like that (count($matches) -2) work from the end of the url, backwards, not from .com forwards? if you know that the position of those strings is the same all the time, maybe access them directly? (i.e. $matches[3])
Comment #3
plopescClosing given that this issue is not related to this module behavior.
Please, feel free to reopen if we can do something from the video_embed_module side.
Regards.