Funkcija: pdg_get_youtube_video_thumbnail

Apraksts

Atgriež saiti uz bildi no YouTube video.

Parametri

$id ( required ) ( string )

YouTube video ID, vai YouTube video saite.

$quality ( optional ) ( string ) ( default: max )

Bildes kvalitāte. Iespējamās vērtības ir low | medium | high | max

Atgriež

( string )

Atgriež saiti uz bildi no YouTube video.

Piemēri

Iegūst YouTube video bildi no saites.

                                <?php
$link  = 'https://www.youtube.com/watch?v=Ef1nJWtkprU&ab_channel=MOSTLYstrings';
$thumb = pdg_get_youtube_video_thumbnail( $link );
?>

<img src="<?php echo $thumb; ?>">
                            

Iegūst YouTube video bildi no video id zemā kvalitātē.

                                <?php
$link  = 'https://www.youtube.com/watch?v=Ef1nJWtkprU&ab_channel=MOSTLYstrings';
$id    = pdg_get_youtube_video_id( $link );
$thumb = pdg_get_youtube_video_thumbnail( $id, 'low' );
?>

<img src="<?php echo $thumb; ?>">