Author Topic: [req]youtube.class.php on 4images  (Read 4997 times)

0 Members and 1 Guest are viewing this topic.

SnaFy

  • Guest
[req]youtube.class.php on 4images
« on: January 02, 2009, 01:11:54 PM »
hi all
 YouTube PHP class
 used for embedding videos as well as video screenies on web page without single line of HTML
can anybody add this to 4images

Code: [Select]
<?php

# YouTube PHP class
# used for embedding videos as well as video screenies on web page without single line of HTML code
#
# Dedicated to my beloved brother FILIP. Rest in peace!
#
# by Avram, www.avramovic.info

class YouTube {

function 
_GetVideoIdFromUrl($url) {
    
$parts explode('?v=',$url);
    if (
count($parts) == 2) {
        
$tmp explode('&',$parts[1]);
        if (
count($tmp)>1) {
            return 
$tmp[0];
        } else {
            return 
$parts[1];
        }
    } else {
        return 
$url;
    }
}

function 
EmbedVideo($videoid,$width 425,$height 350) {
    
$videoid $this->_GetVideoIdFromUrl($videoid);
    return 
'<object width="'.$width.'" height="'.$height.'"><param name="movie" value="http://www.youtube.com/v/'.$videoid.'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'.$videoid.'" type="application/x-shockwave-flash" wmode="transparent" width="'.$width.'" height="'.$height.'"></embed></object>';
}

function 
GetImg($videoid,$imgid 1) {
    
$videoid $this->_GetVideoIdFromUrl($videoid);
    return 
"http://img.youtube.com/vi/$videoid/$imgid.jpg";
}

function 
ShowImg($videoid,$imgid 1,$alt 'Video screenshot') {
    return 
"<img src='".$this->GetImg($videoid,$imgid)."' width='130' height='97' border='0' alt='".$alt."' title='".$alt."' />";
}

}

?>

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [req]youtube.class.php on 4images
« Reply #1 on: March 03, 2009, 07:22:05 AM »
Anyone want to write a turuorial on how to integrate this withh 4images?
As long as I can finish my site before I die.

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: [req]youtube.class.php on 4images
« Reply #2 on: May 28, 2009, 07:18:41 PM »
Würde mich auch interessieren!