Jump to content

Recommended Posts

My Programmer used this code to strip out characters expect the youtube ID in order to create the thumbnail picture of youtube video.

 

For a youtube link like: src="http://www.youtube.com/watch?v=XrL5YIsUQu0"

 

He used this code:

$colony 	= explode("src=",$videoembed);
		$colonized 	= explode("/",$colony[1]);
		$colonizer 	= explode("\"",$colonized[4]);
                        $coloni         = explode("&",$colonizer[4]);
		$thumb_name	= "http://img.youtube.com/vi/".$colonizer[0]."/default.jpg";

So that thumbnail image URL result will be http://img.youtube.com/vi/XrL5YIsUQu0/default.jpg

 

Now Youtube has additional strings with src=link. I am not able to explode the addition strings by using above method.

 

Now Youtube link look like this: src="http://www.youtube.com/watch?v=XrL5YIsUQu0&hl=en&fs=1&rel=0"

 

How to strip out &hl=en&fs=1&rel=0 after the youtube video ID by using same above method?

 

Now youtube thumbnail image link comes like this:

http://img.youtube.com/vi/XrL5YIsUQu0&hl=en&fs=1&rel=0/default.jpg

 

I want it as http://img.youtube.com/vi/XrL5YIsUQu0/default.jpg

 

Your help will be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/164840-php-explode-function-help/
Share on other sites

We're here to help people with code they have having troubles writing, not for writing the code for people. You can use the freelance section of the site for that. Or else you can have your developer come here and show us what he has already written, and we can help him with whatever problems he is having.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.