In the present day, YouTube embed video is used on many websites. Many web project needs to implement a YouTube video gallery where YouTube video thumbnails are dynamically listed in the gallery. In this article, we’ll provide the short PHP snippet to get YouTube video thumbnail image URL using PHP. This simple PHP script is very useful when you want to get the YouTube video thumbnail image URL dynamically based on the provided YouTube URL. Using this YouTube thumbnail URL, you can design the video gallery as per your project needs. Get Thumbnail Image URL from YouTube Embed Code The following PHP code extracts the src value from YouTube Embed Code and generates the video thumbnail image URL based on YouTube video ID. $embedCode = '<iframe width="560" height="315" src="https://www.youtube.com/embed/dwJasig9Olw" frameborder="0" allowfullscreen></iframe>'; preg_match('/src="([^"]+)"/', $embedCode, $match)...