Skip to content

Get the thumbnail of youtube and vimeo videos from the url. The returned information is ID and URL of the thumbnail

Notifications You must be signed in to change notification settings

fernandovaller/thumbnail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video Thumbnail URL

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);

About

Get the thumbnail of youtube and vimeo videos from the url. The returned information is ID and URL of the thumbnail

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages