Because
Nibbler's Youtube mod doesn't work for me (I'm using a freehoster with PHP URL fopen disabled), I created another method to "upload" Youtube videos to your Coppermine gallery.
Open
themes/<yourtheme>/theme.php and copy the function
theme_html_picture() from
themes/sample/theme.php to your theme.php, if it isn't already there.
Search
$pic_html = '<object id="'.$player['id'].'" '.$player['clsid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
$pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
$pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
$pic_html .= "</object><br />\n";
and replace it with
if ($mime_content['extension'] == "youtube") {
// get content of .youtube file
$youtube_file_content = file_get_contents($picture_url);
// remove apostrophes and quotes
$youtube_file_content = str_replace("'", "", $youtube_file_content);
$youtube_file_content = str_replace("\"", "", $youtube_file_content);
// get youtube video id
$youtube_file_content = str_replace("http://www.youtube.com/watch?v=", "", $youtube_file_content);
$youtube_file_content = explode("&", $youtube_file_content);
$youtube_video_id = $youtube_file_content[0];
// check if video id is valid
if (strlen($youtube_video_id) == "11") {
$youtube_check_result = preg_match("/[A-Za-z0-9_-]{11}/", $youtube_video_id, $youtube_video_id_valid);
}
// embed video or print error message
if ($youtube_check_result == "1" ) {
$pic_html = "<embed type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"640\" height=\"385\" src=\"http://www.youtube.com/v/{$youtube_video_id_valid[0]}&hl=de&fs=1\" />";
} else {
$pic_html = "Error: no valid youtube video id";
}
} else {
$pic_html = '<object id="'.$player['id'].'" '.$player['clsid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
$pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
$pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
$pic_html .= "</object><br />\n";
}
Next you have to add the filetype ".youtube" to the database. Download the attached file, copy it to your cpg root directory and call it in your browser.
To add a Youtube video to your gallery, you have to create a file with the extension ".youtube". The file should contain the youtube video ID (e.g. if you watch the video
http://www.youtube.com/watch?v=6B26asyGKDo, the video ID is
6B26asyGKDo). The whole youtube url should also work, but if you copy only the ID into your file, you are on the safe side.
At least check if the youtube filetype is allowed in the config. If all is done, you can upload your .youtube files like every other file.
The thumbnail for the video can be created as described
here.