How to add template in codeigniter |how to create template in codeigniter| template in codeigniter 4
Thumbnail image youtube video
Today I am going to discuss on a tutorial , How to show thumbnail image of youtube video.Sometime we need to embed youtube video in application, then we need to show the preview thumbnail image.Some news broadcasting websites are showing video thumbnails for a quick look into the videos.
So if you want to show the thumbnail from youtube video in php , then follow the step.
<?php $videoid=""; if (isset($_POST['submit'])) { $url = $_POST['url']; $val= explode("v=", $url); $videoid = $val[1]; } ?> <div class="video-image-thumbnail"> <form method="post"> <input class="form-control" type="text" name="url" placeholder="Enter Youtube URL"><br /> <br /> <input class="submit" type="submit" name="submit" value="Submit"> </form> <div class="img"> <?php if (! empty($videoid)) { ?> <img src="https://img.youtube.com/vi/<?php echo $videoid; ?>/hqdefault.jpg" style="width:250px;height:250px" /> <?php } ?> </div> </div>
Related posts