Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Video Picture Linking! (http://www.go4expert.com/forums/video-picture-linking-t27450/)

machineman 27Dec2011 04:23

Video Picture Linking!
 
My blog is regularly updated with videos so the main page loading speed isn't very fast:
vidstowatch.com

I'm going to try and explain this as best i can: Basically instead of being able to play videos from the main page. I'd like to have just the image of the video (from Youtube, Metacafe, College Humor or any other video site i may use) on the main page that once selected re-directs the user to the page with the video on where they can play the video properly.

Does that make sense and is it possible?

Thank you

shabbir 27Dec2011 09:06

Re: Video Picture Linking!
 
Yes why not and where do you host your videos?

ritsmontu 27Dec2011 20:59

Re: Video Picture Linking!
 
You can use the Youtube API Tools to get thumbnail images.

ritsmontu 27Dec2011 21:03

Re: Video Picture Linking!
 
Quote:

Originally Posted by machineman (Post 90583)
My blog is regularly updated with videos so the main page loading speed isn't very fast:
vidstowatch.com

I'm going to try and explain this as best i can: Basically instead of being able to play videos from the main page. I'd like to have just the image of the video (from Youtube, Metacafe, College Humor or any other video site i may use) on the main page that once selected re-directs the user to the page with the video on where they can play the video properly.

Does that make sense and is it possible?

Thank you

Quote:

Each YouTube video has 4 generated images. They are predictably formatted as follows:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
For the high quality version of the thumbnail use a url similar to this:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg
For the maximum resolution version of the thumbnail use a url similar to this:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg
PHP Code:

function print_video($id)
{
echo 
"<a href='http://www.youtube.com/watch?v={$id}' target='_blank'>
<img src='http://img.youtube.com/vi/
{$id}/0.jpg' />
</a>
"
;



Source: http://stackoverflow.com/questions/2...ng-youtube-api


All times are GMT +5.5. The time now is 15:59.