Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to Get Thumbnail From Youtube Video Using PHP

by
Category:php
php codeigniter laravel html
How to Get Thumbnail From Youtube Video Using PHP

Sometime it’s necessary to display the Thumbnail Image of a youtube video from URL. So in this tutorial am going to example you how to get the thumbnail image of a video from youtube. Here am using PHP to obtain the output. You may also like How to Fullscreen Background Video Using HTML And CSS and Multiple Image Upload in PHP.

HTML Code

<html>
    <head></head>
    <body>
        <form method="post" action="">
            <input type="text" name="url" placeholder="Enter URL">
            <input type="submit" name="get_thumbnail" value="GET THUMBNAIL">
        </form>
    </body>
</html>

PHP Code

<?php
if(isset($_POST['get_thumbnail']))
{
    $url=$_POST['url'];
    $fetch=explode("v=", $url);
    $videoid=$fetch[1];
    echo '<img src="http://img.youtube.com/vi/'.$videoid.'/0.jpg" width="250"/>';
}
?>

0 Comments


Html code work in comment box


Related Post