How to get image from youtube and vimeo embedded url?

This tutorial for gettting the image from youtube and vimeo embedded url using the php code without any 3rd party tools. you can just enter the embedded url in below code and get HD Image from this two plateform

Step 1)

just put this code in your php file where you want to get the youtube and vimeo embedded url image in high resolution.

$url2 = "Your youtube and vimeo embedded url here";
$parsed     = parse_url($url2);
$hostname   = $parsed['host']; 
$path       = $parsed['path']; 
  if($hostname=='' || $hostname==''){
	preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url2, $match);
	$youtube_id = $match[1];
        $videoID = substr($youtube_id,0,11);
        $video_image_src = "".$videoID."/maxresdefault.jpg";
	$video_image_href = "".$videoID;
}else if($hostname==''){
	preg_match("/vimeo\.com\/(\w+\s*\/?)*([0-9]+)*$/i", $url2, $output_array);
	$vimdeoIDInt = intval($output_array[1]);
	$vimeo = unserialize(file_get_contents("$vimdeoIDInt.php"));
	$small = $vimeo[0]['thumbnail_small'];
	$medium = $vimeo[0]['thumbnail_medium'];
	$large = $vimeo[0]['thumbnail_large'];
        $video_image_src = $large;
	$video_image_href = "".$vimdeoIDInt; 
echo $video_image_href;

3 thoughts on “How to get image from youtube and vimeo embedded url?

  1. tempmail

    I do not even know how I ended up here but I thought this post was great I dont know who you are but definitely youre going to a famous blogger if you arent already Cheers.

  2. zencortex reviews

    This website has quickly become my go-to source for [topic]. The content is consistently top-notch, covering diverse angles with clarity and expertise. I’m constantly recommending it to colleagues and friends. Keep inspiring us!


Leave a Reply

Your email address will not be published. Required fields are marked *