backend developer

Show image thumbnail by Youtube Video in PHP

Goodday , actualy pulling thumbnails from youtube video is one common thing which developers impement on their websites, but firstly what are thumbnails?

Thumbnails are used for preview a single or group of media entities in a single explorer window. By showing thumbnails, we can have a shortcut or quick-view to see more voluminous data without navigation. Websites use thumbnails to showcase content in a gallery format. For example, the online shopping cart websites showcase their product gallery with image thumbnails. The news broadcasting websites are showing video thumbnails for a quick look into the videos.

I created the thumbnail image URL from the YouTube video source URL using PHP. The video URL is given as an input posted via HTML form. In PHP, the unique id of the video is extracted and used to form the image thumbnail source. If you want to show an image thumbnail in a gallery for your favorite YouTube videos, you can use this example to get the thumbnail source URL.

Getting Video URL using HTML Form

This HTML code is used to show a HTML form with an input option to let the user enter the YouTube video URL. After submitting the form, the input URL is processed in a PHP file to show the image thumbnail.

<h2>Show Image Thumbnail by YouTube Video URL using PHP</h2>

<div class="frm-video-image-thumbnail">
    <form method="post" action="">
        <input class="input-field" type="text" name="url"
            placeholder="Enter URL"><br /> <br /> <input
            class="btn-submit" type="submit" name="submit"
    <div class="thumbnail">
if (! empty($videoId)) {
        <h3 class="thumb-head">Thumbnail Image:</h3>
            src="<?php echo $videoId; ?>/hqdefault.jpg"
            width="250" />

Create Thumbnail Source From Video using PHP Code

This PHP code reads the video URL posted via the HTML form. It extracts the unique id from the video using PHP explode(). Then it creates the thumbnail source URL by using the unique id of the video. This source URL is used to show the preview of the video using thumbnail image.

if (isset($_POST['submit'])) {
    $url = $_POST['url'];
    $value = explode("v=", $url);
    $videoId = $value[1];

Image Thumbnail Screenshot from YouTube Video URL

This screenshot shows the thumbnail image output created by using the given YouTube URL.




  • I am sure this article has touched all the internet people,
    its really really nice paragraph on building up new website.

    Ahaa, its fastidious discussion concerning this paragraph at this place at this webpage,
    I have read all that, so now me also commenting at this place.

    Hi, I log on to your new stuff like every week. Your writing style is witty, keep it up!

  • I couldn’t refrain from commenting. Very well written! It’s appropriate time to make a few plans for the long run and it’s time to be happy.
    I have read this post and if I may I want to counsel you few attention-grabbing issues or tips.

    Maybe you can write next articles relating to this article.
    I want to read more issues approximately it!
    There is definately a lot to know about this subject. I love all the points
    you made.

  • With havin so much content and articles do you ever run into
    any problems of plagorism or copyright infringement?

    My blog has a lot of unique content I’ve either created myself
    or outsourced but it looks like a lot of it is popping it
    up all over the web without my permission. Do you know any techniques
    to help reduce content from being ripped off?
    I’d really appreciate it.

  • If you might be visiting another city in order to find that
    you have a good show in that city, you can’t investigate
    different lenders to the box office, stand in a line and buy the tickets.

    They will shun jobs its keep is not any help to the neighborhood involved.
    Now you’ve taken that all-important initial step and
    therefore are reading this report about flash games and social networking, you’re
    inside the unique and privideged position for being amongst several
    pioneering entreprenuers who know about it and so are taking affirmative action.

  • Hello there! This blog post could not be written much better!
    Looking at this article reminds me of my previous roommate!
    He continually kept talking about this. I am going to send
    this article to him. Fairly certain he’s going to
    have a good read. Thanks for sharing!

  • Rachel Armstrong (Kate Beckinsale) can be a young and promising reporter with the Capitol Sun-Times, a major Washington,
    D. The instrument comprises of different materials like metal, wool, buckskin and wood.

    Then again, it could supply the fuel for the perfect headlining scandal.

Your Header Sidebar area is currently empty. Hurry up and add some widgets.