fernandovaller / thumbnail
Get the thumbnail of youtube and vimeo videos from the url. The returned information is ID and URL of the thumbnail
Installs: 53
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/fernandovaller/thumbnail
Requires
- guzzlehttp/guzzle: 7.*
README
Get the thumbnail of youtube and vimeo videos from the url. The returned information is ID and URL of the thumbnail
Installation
Install the latest version with
$ composer require fernandovaller/thumbnail
Basic Usage
<?php use FVCode\Thumbnail\Thumbnail; require __DIR__ . '/vendor/autoload.php'; $th = new Thumbnail(); $url = 'youtube|vimeo URL video'; // The returned information is ID and URL of the thumbnail $data = $th->get($url);
Config
Vimeo videos can have origin restriction, in which case add the setting to simulate the origin in the request.
<?php use FVCode\Thumbnail\Thumbnail; require __DIR__ . '/vendor/autoload.php'; $config = [ 'origin' => 'https://www.google.com' ]; $th = new Thumbnail($config); $url = 'youtube|vimeo URL video'; // The returned information is ID and URL of the thumbnail $data = $th->get($url);
Noembed
<?php use FVCode\Thumbnail\Thumbnail; require __DIR__ . '/vendor/autoload.php'; $th = new Thumbnail(); $url = 'youtube|vimeo URL video'; // The returned information is array [title, thumbnail_url, video_id, ...] $data = $th->getNoembed($url);