PHP code example of canducci / thumbnail

1. Go to this page and download the library: Download canducci/thumbnail library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

canducci / thumbnail example snippets


"canducci/thumbnail": "0.1.1"


'providers' => array(
    ...,
    Canducci\Thumbnail\Providers\ThumbnailServiceProvider::class

),


'aliases' => array(
    ...,
    'Thumbnail'   => Canducci\Thumbnail\Facades\Thumbnail::class

),


use Canducci\Thumbnail\Thumbnail;

$thumb = new Thumbnail('address_video_youtube');


use Canducci\Thumbnail\Facades\Thumbnail;


$thumb = Thumbnail::setUrl('address_video_youtube');


$thumb = thumbnail('address_video_youtube');


use Canducci\Thumbnail\Contracts\ThumbnailContract;


public function index(ThumbnailContract $thumbnail)
{

      $thumb = $thumbnail->setUrl('address_video_youtube');
      
 

$thumb = Thumbnail::setUrl('address_video_youtube'); //Facade

$thumb = $Thumbnail->setUrl('address_video_youtube'); //Contracts

$thumb = thumbnail('address_video_youtube'); // Helper

$thumb = new Thumbnail('address_video_youtube'); //Simply instance


$thumb = thumbnail('address_video_youtube');

$thumb->savePictures('thumbnail/');



$thumb = thumbnail('address_video_youtube');

$thumb->getPicture0()->save('thumbs/');


$thumb = thumbnail('address_video_youtube');

$pathWeb = $thumb->getPicture0()->getFileWeb('thumbs/');

//result '/thumbs/xtzxYWz0D_9-0.jpg';


$thumb = thumbnail('address_video_youtube');

$pathWeb = $thumb->getPicture0()->getUrl();

//result 'http://i1.ytimg.com/vi/xtzxYWz0D_9/0.jpg';

public function getPictureDefault();
public function getPicture0();
public function getPicture1();
public function getPicture2();
public function getPicture3();
public function getPictureStandard();
public function getPictureMediumQuality();
public function getPictureHighQuality();
public function getPictureMaximumResolution();


public function getUrl();
public function save($path);
public function getFileWeb($path);
public function toArray();
public function toJson();

public function getUrl();
public function getCode();
public function setUrl($url);
public function getPictureDefault();
public function getPicture0();
public function getPicture1();
public function getPicture2();
public function getPicture3();
public function getPictureStandard();
public function getPictureMediumQuality();
public function getPictureHighQuality();
public function getPictureMaximumResolution();
public function getUrlVideoShare();
public function getTagVideoEmbed($width = 560, $height = 315, 
	$frameborder = 0, $suggestvideo = true, $controls = true, 
	$showinfo = true, $privacidade = false);
public function getInformationVideo();
public function savePictures($path);
public function getPictures();
public function toArray();
public function toJson();



//share
public function getUrlVideoShare(); // return link share

//embed
public function getTagVideoEmbed($width = 560, $height = 315,  
  $frameborder = 0, $suggestvideo = true, $controls = true, $showinfo = true, 
  $privacidade = false); //return tag frame

Route::get('thumb', function()
{
	$thumb    = thumbnail('address_video_youtube');
	$picture0 = $thumb->getPicture0();
	$picture0->save('t/');
	echo $picture0->getFileWeb('t/');
});

use Canducci\Thumbnail\Contracts\ThumbnailContract;
Route::get('thumb1', function(ThumbnailContract $thumb)
{	
	$thumb->setUrl('address_video_youtube');
	$picture0 = $thumb->getPicture0();
	$picture0->save('t/');
	echo $picture0->getFileWeb('t/');
});

use Canducci\Thumbnail\Facades\Thumbnail;
Route::get('thumb2', function()
{	
	$thumb = Thumbnail::setUrl('address_video_youtube');
	$picture0 = $thumb->getPicture0();
	$picture0->save('t/');
	echo $picture0->getFileWeb('t/');
});

use Canducci\Thumbnail\Thumbnail as Thumb;
Route::get('thumb3', function()
{	
	$thumb = new Thumb('address_video_youtube');
	$picture0 = $thumb->getPicture0();
	$picture0->save('t/');
	echo $picture0->getFileWeb('t/');
});

use Canducci\Thumbnail\Thumbnail as Thumb;
Route::get('thumb4', function()
{	
	$thumb = new Thumb('address_video_youtube');
	$thumb->savePictures('t/');	
	echo $thumb->getPicture0()->getFileWeb('t/');
});

use Canducci\Thumbnail\Thumbnail as Thumb;
Route::get('thumb5', function()
{	
	$thumb = new Thumb('address_video_youtube');
	echo $thumb->getUrlVideoShare();
	echo '<br>';	
	echo $thumb->getTagVideoEmbed();
});

$thumb = thumbnail('address_video_youtube');
return $thumb->getInformationVideo()->toArray(); 
//or
return $thumb->getInformationVideo()->toJson();

public function getAuthor();
public function setAuthor($author);
public function getTitle();
public function setTitle($title);
public function getVideoId();
public function setVideoId($video_id);
public function getHostLanguage();
public function setHostLanguage($host_language);
public function getKeywords();
public function setKeywords($keywords);
public function getTimestamp();
public function setTimestamp($timestamp);
public function getLengthSeconds();
public function setLengthSeconds($length_seconds);
public function getViewCount();
public function setViewCount($view_count);
public function getThumbnail();
public function setThumbnail($thumbnail);
public function getAdaptiveFmts();
public function setAdaptiveFmts(IThumbnailAdaptiveFmtsCollection $adaptive_fmts);
public function getUrlEncodedFmtStreamMap();
public function setUrlEncodedFmtStreamMap(IThumbnailUrlEncodedFmtStreamMapCollection $url_encoded_fmt_stream_map);
public function toArray();
public function toJson();