if (!function_exists('file_put_contents')) {
function file_put_contents($n,$d) {
$f=@fopen($n,"w");
if (!$f) {
return false;
} else {
fwrite($f,$d);
fclose($f);
return true;
}
}
}
// Add the control device.
$form_array[] = array('control', 'phase_1', 4);
// Youtube
if (USER_ID) {
$form_array[] = 'Youtube uploads';
$form_array[] = array('', 'YT_array[]', 0, 256, 3);
$form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
}
//Now we must prepare the inital form for adding the pictures to the database, and we must move them to their final location.
// youtube
$YT_array = count($_POST['YT_array']);
if ($YT_array) {
$YT_failure_array = array();
for ($counter = 0; $counter < $YT_array; $counter++) {
// Create the failure ordinal for ordering the report of failed uploads.
$failure_cardinal = $counter + 1;
$failure_ordinal = ''.$failure_cardinal.'. ';
$YT_URI = $_POST['YT_array'][$counter];
if (!$YT_URI) continue;
if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = $xmatches[1];
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
} else {
$YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
}
} else {
$YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> 'Failed to find video');
}
}
}
$zip_error_count = count($zip_failure_array);
$YT_error_count = count($YT_failure_array);
// Create error report if we have errors.
if (($file_error_count + $URI_error_count + $zip_error_count) > 0) {
// Create error report if we have errors.
if (($file_error_count + $URI_error_count + $zip_error_count + $YT_error_count) > 0) {
// Close the error report table.
endtable()
// Look for YT upload errors.
if ($YT_error_count > 0) {
// There are URI upload errors. Generate the section label.
form_label("YT errors:");
echo "<tr><td>URI</td><td>Error message</td></tr>";
// Cycle through the file upload errors.
for ($i=0; $i < $YT_error_count; $i++) {
// Print the error ordinal, file name, and error code.
echo "<tr><td>{$YT_failure_array[$i]['failure_ordinal']} {$YT_failure_array[$i]['URI_name']}</td><td>{$YT_failure_array[$i]['error_code']}</td></tr>";
}
}
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
if (preg_match('/^youtube_(.*)\.jpg$/', $file_set[0], $ytmatches)){
$vid = $ytmatches[1];
$xdata = file_get_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml");
// todo: parse the xml properly
preg_match('/<description>(.*)<\/description>/', $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<tags>(.*)<\/tags>/', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match('/<title>(.*)<\/title>/', $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
$form_array = array(
array($lang_upload_php['album'], 'album', 2),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1, $title),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length'], $description),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1, $keywords),
array('control', 'phase_2', 4),
array('unique_ID', $_POST['unique_ID'], 4),
);
} else {
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
}
if (isset($image_size['reduced'])) {
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
1YouTube internal error. Please report this issue -- including the exact method of producing this error -- to YouTube.
Fatal error: Call to undefined function: file_put_contents() in /home/fhlinux192/n/nino.fruitvalestudios.com/user/htdocs/gallery/upload.php on line 2064
PHP 5 (I will review this later, it is only required for convenience)Any update on this? I have PHP 4.4.1 and really like to have this mod.
if (!function_exists('file_put_contents')) {
function file_put_contents($n,$d) {
$f=@fopen($n,"w");
if (!$f) {
return false;
} else {
fwrite($f,$d);
fclose($f);
return true;
}
}
}
No idea.
Parse error: parse error, unexpected $ in /home/xxxxxxxxx/public_html/gallery/upload.php on line 2702
Heh... I don't know if I did everything right, but... I got this trying to open Upload page:Code: [Select]Parse error: parse error, unexpected $ in /home/xxxxxxxxx/public_html/gallery/upload.php on line 2702
0 uploads were successful.
This Sitemap has the following errors:
Leading whitespace
We've detected that your Sitemap file begins with whitespace. We've accepted the file, but you may want to remove the whitespace so that the file adheres to the XML standard.
You probably added some whitespace at the end of your theme.php by accident.Yup, I have fixed the sitemap.. You were right, I had put the code at the end of my theme.php then I move copy theme_html_picture() to the top after
define('THEME_IS_XHTML10_TRANSITIONAL',1);
and works fine now.I have install the mod , but , I upload an video , But I get only the jpg and not the videoI have the same problem before, I just re-do editing for theme.php and now its works perfect.
i try again,
// Displays a picture
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$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";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
);
return template_eval($template_display_media, $params);
}
They remain at youtube. Only the thumbnail is copied to your gallery.
$cmdline = 'composite -compose over -gravity southeast "youtubewatermark.png" "tmp.jpg" '.'"tmp.jpg" 2>&1';
exec($cmdline);
0 uploads were successful.
Error Report
The following uploads encountered errors:
YT errors:
URI Error message
1. http://www.youtube.com/watch?v=7PZK8koGcmM
4Missing required parameter
You must however have cURL available instead.
if(USER_UPLOAD_FORM == '0') {
// The user should have the 'single upload only' form.
if ($CONFIG['read_iptc_data']) {
$iptc = get_IPTC($path_to_image);
}
if (preg_match('/^youtube_(.*)\.jpg$/', $file_set[0], $ytmatches)){
$iptc = array();
$vid = $ytmatches[1];
$xdata = file_get_contents("albums/edit/yt_".$vid.".xml");
// todo: parse the xml properly
preg_match('/<description>(.*)<\/description>/', $xdata, $xmatches);
$iptc['Caption'] = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<tags>(.*)<\/tags>/', $xdata, $xmatches);
$iptc['Keywords'] = explode(" ", $xmatches[1]);
// todo: parse the xml properly
preg_match('/<title>(.*)<\/title>/', $xdata, $xmatches);
$iptc['Title'] = substr($xmatches[1], 0, 255);
} elseif ($CONFIG['read_iptc_data']) {
$iptc = get_IPTC($path_to_image);
}
if(!empty($CONFIG['user_field4_name'])) {
there are two of them, you can replace both, but in my case the first one is never used. // youtube/video flag
if (preg_match('/^youtube_.*\.jpg$/', $file_set[0])){
// youtube video duration
preg_match('/<length_seconds>([0-9]*)<\/length_seconds>/', $xdata, $xmatches);
$yt_flag_data = $xmatches[1]."|";
// youtube view count
preg_match('/<view_count>([0-9]*)<\/view_count>/', $xdata, $xmatches);
$yt_flag_data .= $xmatches[1]."|";
// youtube upload time
preg_match('/<upload_time>([0-9]*)<\/upload_time>/', $xdata, $xmatches);
$yt_flag_data .= $xmatches[1]."|";
// our update time
$yt_flag_data .= time();
$form_array[] = array('user4', $yt_flag_data, 4);
} elseif(!empty($CONFIG['user_field4_name'])) {
// First, we delete the preview image.
if ((!strstr($preview_path, 'thumb')) and (file_exists($preview_path))) {
unlink($preview_path);
// youtube xml data cleanup
if (preg_match('/^youtube_(.*)\.jpg$/', $file_set[0], $ytmatches)){
if (file_exists("albums/edit/yt_".$ytmatches[1].".xml")) {
unlink("albums/edit/yt_".$ytmatches[1].".xml");
}
}
Code: [Select]// Youtube
if (USER_ID) {
$form_array[] = 'Youtube uploads';
$form_array[] = array('', 'YT_array[]', 0, 256, 3);
$form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
}
Change that section to set permissions. Remove the USER_ID check if you want to allow anyone to use it.
Hi Nibbler,
I am confused with theme.php which theme.php should we change, the ones we use for default template or only on /sample/theme.php ?
Thank you
Don't worry I solved the problem :) works like charming!
h4nh4n
You have some issue with duplicate files. Add a video you have never added before.
Duplicates are normally handled fine by Coppermine, but since this is just a hack it is not so clean. You need to delete the thumbnails of the youtube videos from your FTP (thumb_youtube_xxx.jpg)
It won't fix existing problems. It will stop it happening for future videos.
Hi
I have a small Problem
The Upload works fine, then i select the album and then i got this message
The previous file could not be placed.
You have successfully placed all the files.
What i have to do
0 uploads were successful.
Error Report
The following uploads encountered errors:
YT errors:
URI Error message
1. http://www.youtube.com/watch?v=7PZK8koGcmM
4Missing required parameter
If you get this error, there is probably a space after your Developer ID.
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br /><table align=\"center\">';
Problems "browse upload"...
YouTube upload working very fine, but "normal browse uploads" not working...
i select "Upload" and browse my computer picture, and click "Continue"...
(http://img166.imageshack.us/img166/6245/gallery1bd3.gif)
Now come problems.... look image...
(http://img250.imageshack.us/img250/1271/gallery2hi0.gif)
And now i click "Continue" so image no uploads my gallerys...
Upload return back first towards...
(http://img176.imageshack.us/img176/4689/gallery3df0.gif)
Thank you very much! ;)
if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change
faultCode0faultStringFatal error:Call to undefined function curl_init() in /home/vol1/phpnet.us/v/vinubhai/www/gallery/upload.php on line 73
// Youtube
if (USER_ID) {
$form_array[] = 'Youtube uploads';
$form_array[] = array('', 'YT_array[]', 0, 256, 3);
$form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
}
theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2006 Coppermine Dev Team
v1.1 originally written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
********************************************
Coppermine version: 1.4.9
$Source$
$Revision: 3125 $
$Author: gaugau $
$Date: 2006-06-16 08:48:03 +0200 (Fr, 16 Jun 2006) $
**********************************************/
// ------------------------------------------------------------------------- //
// This theme has all CORE items removed //
// ------------------------------------------------------------------------- //
define('THEME_IS_XHTML10_TRANSITIONAL',1);
?>
I have exactly the same problem here! Plz help me to fix this problem.
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
if (preg_match('/^youtube_(.*)\.jpg$/', $file_set[0], $ytmatches)){
$vid = $ytmatches[1];
$xdata = file_get_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml");
// todo: parse the xml properly
preg_match('/<description>(.*)<\/description>/', $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<tags>(.*)<\/tags>/', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match('/<title>(.*)<\/title>/', $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
$form_array = array(
array($lang_upload_php['album'], 'album', 2),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1, $title),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length'], $description),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1, $keywords),
array('control', 'phase_2', 4),
array('unique_ID', $_POST['unique_ID'], 4),
);
} else {
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
}
$form_array = array(
array($lang_upload_php['album'], 'album', 2),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1, $title),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length'], (isset($iptc['Caption'])) ? $iptc['Caption'] : ''),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1,(isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']): ''),
array('control', 'phase_2', 4),
array('unique_ID', $_POST['unique_ID'], 4),
);
// Displays a picture
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$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";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
);
return template_eval($template_display_media, $params);
}
// Displays a picture
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$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";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
);
return template_eval($template_display_media, $params);
}
</embed></object><br />';
</embed></object><br /><a href="http://videodownloader.net/get/?url=http://youtube.com/watch?v='. $vid . '"><img src="http://javimoya.com/blog/vd/botdl.gif"></a>';
</embed></object><br />';
</embed></object><br /><a href="http://cache.googlevideo.com/get_video?video_id='. $vid . '">Download it!</a>
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '&rel=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
<?php
/*
For use with: Displaying videos from Youtube in Coppermine
At http://forum.coppermine-gallery.net/index.php?topic=37962.0
This will use the youtube feed API to search and pull video from
youtube. You can either specify title, author, start index and max result
max result is 50. So use start index to get all the stuff you want from youtube.
It was usefully for me. I hope you find it usefull too
Toua or dreams83 :)
*/
define('IN_COPPERMINE', true);
define('LOGIN_PHP', true);
require('include/init.inc.php');
global $USER_DATA;
pageheader("YouTube Search");
starttable('100%', "Download from YouTube",2);//$lang_login_php['enter_login_pswd'], 2);
echo <<< EOT
<tr>
<td class="tableb" >
<table width="100%" cellspacing="2" cellpadding="2">
<tr>
<td>
EOT;
echo '
<form id="search_tube" name="search_tube" method="post" action="youtube_search.php">
Enter Search: <input name="q" id="q" type="text" size="50" maxlength="180" value="'.$_REQUEST['q'].'" /><br/><br/>
Enter Author: <input name="art" id="art" type="text" size="50" maxlength="180" value="'.$_REQUEST['art'].'" /><br/><br/>
Start Index: <input name="stid" id="stid" type="text" size="50" maxlength="180" value="'.$_REQUEST['stid'].'" /><br/><br/>
Max Result: <input name="mrt" id="mrt" type="text" size="50" maxlength="180" value="'.$_REQUEST['mrt'].'" /><br/><br/>
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
';
if(($_REQUEST['q']!="" || $_REQUEST['art']!= "") && GALLERY_ADMIN_MODE ){
$after = "";
if($_REQUEST['art']!= "" ){
$after .= "&author=".$_REQUEST['art'];
}
if( $_REQUEST['q']!= "" ){
$after .= '&vq='.$_REQUEST['q'];
}
if(is_numeric($_REQUEST['stid'])){
$after .= "&start-index=".$_REQUEST['stid'];
}
if(is_numeric($_REQUEST['mrt'])){
$after .= "&max-results=".$_REQUEST['mrt'];
}
echo '<h4>See The Search Result (These are the video you will upload to your Coppermine Gallery):</h4><a href="http://gdata.youtube.com/feeds/videos?orderby=updated'.$after.'" target="_blank"><h2>'.$after. '</h2></a>';
$xurl = "http://gdata.youtube.com/feeds/videos?orderby=updated".$after;
$xdata = file_get_contents(str_replace(' ','+',$xurl));
echo '<textarea name="sds" cols="90" rows="20">'.$xdata.'</textarea><br/>';
preg_match_all('/http:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_\+\-\.]{11})/', $xdata, $matches);
$alllist = array_merge(array_unique($matches[0]));
//print_r($alllist);
if(sizeof($alllist)){
echo '
<script language="javascript" type="text/javascript">
function textCounter(field, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
}
</script>
<form method="post" action="upload.php" enctype="multipart/form-data">
<!-- Start standard table -->
<table align="center" width="100%" cellspacing="1" cellpadding="0" class="maintable">
<tr>
<td class="tableh1" colspan="2">Upload file</td>
</tr>
<tr><td colspan="2"><br />
When you finished reviewing what you\'ll get above, please click \'Continue\'.</td></tr>
<tr>
<td class="tableh2" colspan="2">
<b>Youtube uploads</b>
</td>
</tr>';
for($i=0;$i<sizeof($alllist);$i++){
echo '<tr>
<td width="40%" class="tableb">
'.($i+1).'.
</td>
<td width="60%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="YT_array[]" maxlength="256" value="'.$alllist[$i].'" class="textinput" id="YT_array[]" />
</td>
</tr>';
}
echo '<tr>
<td class="tableh2" colspan="2">
<b>Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx</b>
</td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="control" value="phase_1" />
</td>
</tr>
<tr>
<td colspan="2" align="center" class="tablef">
<input type="submit" value="CONTINUE" class="button" />
</td>
</tr>
</table>
<!-- End standard table -->
</form>';
}
}
echo <<< EOT
</td>
</tr>
</table>
</td>
</tr>
EOT;
endtable();
pagefooter();
ob_end_flush();
?>
preg_match_all('/http:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_\+\-\.]{11})/', $xdata, $matches);
Yup, I have fixed the sitemap.. You were right, I had put the code at the end of my theme.php then I move copy theme_html_picture() to the top afterCode: [Select]define('THEME_IS_XHTML10_TRANSITIONAL',1);
and works fine now.
Thanks :)
Also, has anyone had any luck adding a watermark to youtube videos?I have made a mod to Stramms's modpack to add a watermark to the thumbnails of YouTube videos added through this mod.
function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark="false", $sharpen=0, $media_type="false", $quality="false")
{
after it insert:// if filename starts "youtube_", or "orig_youtube_" and ends ".jpg" then assume mediatype is video
if (preg_match('/\/youtube_(.*)\.jpg$/', $src_file) || preg_match('/\/orig_youtube_(.*)\.jpg$/', $src_file)){
$media_type="movie";
}
This works fine for me.I have install the mod , but , I upload an video , But I get only the jpg and not the video
URI Error message
8Bad, unknown, or disabled dev_id specified
YT errors:
URI Error message
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2005 Coppermine Dev Team
v1.1 originally written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
********************************************
Coppermine version: 1.4.3
$Source: /cvsroot/coppermine/stable/themes/digital_red/theme.php,v $
$Revision: 2.0 $
$Author: DaMysterious $
$Date: 2006-01-12 10:01:00 $
**********************************************/
//define('THEME_IS_XHTML10_TRANSITIONAL',1);
// HTML template for main menu
$template_sys_menu = <<<EOT
<span class="topmenu">
<!-- BEGIN my_gallery -->
<a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}">{MY_GAL_LNK}</a><br /><br />
<!-- END my_gallery -->
<!-- BEGIN allow_memberlist -->
<a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}">{MEMBERLIST_LNK}</a><br /><br />
<!-- END allow_memberlist -->
<!-- BEGIN my_profile -->
<a href="{MY_PROF_TGT}">{MY_PROF_LNK}</a><br /><br />
<!-- END my_profile -->
<!-- BEGIN faq -->
<a href="{FAQ_TGT}" title="{FAQ_TITLE}">{FAQ_LNK}</a><br /><br />
<!-- END faq -->
<!-- BEGIN enter_admin_mode -->
<a href="{ADM_MODE_TGT}" title="{ADM_MODE_TITLE}">{ADM_MODE_LNK}</a><br /><br />
<!-- END enter_admin_mode -->
<!-- BEGIN leave_admin_mode -->
<a href="{USR_MODE_TGT}" title="{USR_MODE_TITLE}">{USR_MODE_LNK}</a><br /><br />
<!-- END leave_admin_mode -->
<!-- BEGIN upload_pic -->
<a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}">{UPL_PIC_LNK}</a><br /><br />
<!-- END upload_pic -->
<!-- BEGIN register -->
<a href="{REGISTER_TGT}" title="{REGISTER_TITLE}">{REGISTER_LNK}</a><br /><br />
<!-- END register -->
<!-- BEGIN login -->
<a href="{LOGIN_TGT}" title="">{LOGIN_LNK}</a>
<!-- END login -->
<!-- BEGIN logout -->
<a href="{LOGOUT_TGT}" title="">{LOGOUT_LNK}</a><br />
<!-- END logout -->
</span>
EOT;
// HTML template for sub_menu
$template_sub_menu = <<<EOT
<!-- BEGIN custom_link -->
<a href="{CUSTOM_LNK_TGT}" title="{CUSTOM_LNK_TITLE}">{CUSTOM_LNK_LNK}</a><br /><br />
<!-- END custom_link -->
<!-- BEGIN album_list -->
<a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a><br /><br />
<!-- END album_list -->
<a href="{LASTUP_TGT}">{LASTUP_LNK}</a><br /><br />
<a href="{LASTCOM_TGT}">{LASTCOM_LNK}</a><br /><br />
<a href="{TOPN_TGT}">{TOPN_LNK}</a><br /><br />
<a href="{TOPRATED_TGT}">{TOPRATED_LNK}</a><br /><br />
<a href="{FAV_TGT}">{FAV_LNK}</a><br /><br />
<a href="{SEARCH_TGT}">{SEARCH_LNK}</a>
EOT;
?>
if (isset($image_size['reduced'])) {
// Displays a picture function theme_html_picture() { global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER; global $album, $comment_date_fmt, $template_display_media; global $lang_display_image_php, $lang_picinfo; $pid = $CURRENT_PIC_DATA['pid']; $pic_title = ''; if (!isset($USER['liv']) || !is_array($USER['liv'])) { $USER['liv'] = array(); } // Add 1 to hit counter if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) { add_hit($pid); if (count($USER['liv']) > 4) array_shift($USER['liv']); array_push($USER['liv'], $pid); } if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored $condition = true; }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){ $condition = true; }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){ $condition = true; }else{ $condition = false; } if ($CURRENT_PIC_DATA['title'] != '') { $pic_title .= $CURRENT_PIC_DATA['title'] . "\n"; } if ($CURRENT_PIC_DATA['caption'] != '') { $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n"; } if ($CURRENT_PIC_DATA['keywords'] != '') { $pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords']; } if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_media, 'img_desc'); } else { if (!$CURRENT_PIC_DATA['title']) { template_extract_block($template_display_media, 'title'); } if (!$CURRENT_PIC_DATA['caption']) { template_extract_block($template_display_media, 'caption'); } } $CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : ''; if ($CONFIG['make_intermediate'] && $condition ) { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal'); } else { $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize'); } $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']); $pic_title = ''; $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']); if ($mime_content['content']=='movie' || $mime_content['content']=='audio') { if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) { $CURRENT_PIC_DATA['pwidth'] = 320; // Default width // Set default height; if file is a movie if ($mime_content['content']=='movie') { $CURRENT_PIC_DATA['pheight'] = 240; // Default height } } $ctrl_offset['mov']=15; $ctrl_offset['wmv']=45; $ctrl_offset['swf']=0; $ctrl_offset['rm']=0; $ctrl_offset_default=45; $ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default; $image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"'; } if ($mime_content['content']=='image') { if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'],
Template error
Failed to find block 'my_friends'(#(<!-- BEGIN my_friends -->)(.*?)(<!-- END my_friends -->)#s) in :
<span class="topmenu">
<!-- BEGIN my_gallery -->
<a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}">{MY_GAL_LNK}</a><br /><br />
<!-- END my_gallery -->
<!-- BEGIN allow_memberlist -->
<a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}">{MEMBERLIST_LNK}</a><br /><br />
<!-- END allow_memberlist -->
<!-- BEGIN faq -->
<a href="{FAQ_TGT}" title="{FAQ_TITLE}">{FAQ_LNK}</a><br /><br />
<!-- END faq -->
<!-- BEGIN upload_pic -->
<a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}">{UPL_PIC_LNK}</a><br /><br />
<!-- END upload_pic -->
<!-- BEGIN register -->
<a href="{REGISTER_TGT}" title="{REGISTER_TITLE}">{REGISTER_LNK}</a><br /><br />
<!-- END register -->
<!-- BEGIN login -->
<a href="{LOGIN_TGT}" title="">{LOGIN_LNK}</a>
<!-- END login -->
</span>
http://aro-network.co.uk/ths/HG/
<-- Site link..if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
$xdata = file_get_contents($xurl);
if (preg_match('/veoh\.com\/videos\(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://www.veoh.com/ * At this point i'd need some help*";
$xdata = file_get_contents($xurl);
$vid = $matches[1];
$xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
$xdata = file_get_contents($xurl);
file_put_contents("albums/edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = $xmatches[1];
$rh = fopen($thumbnail, 'rb');
$wh = fopen("albums/edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$vid = $matches[1];
$xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
$ch = curl_init($xurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xdata = curl_exec ($ch);
curl_close ($ch);
file_put_contents("albums/edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = $xmatches[1];
$ch = curl_init($thumbnail);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xdata = curl_exec ($ch);
curl_close ($ch);
file_put_contents("albums/edit/yt_$vid.jpg", $xdata);
8Bad, unknown, or disabled dev_id specified.as I try to upload... I first tried the Developer Key, and then the Client ID, but with the same result :(. Which one should I use, or may there is a coding error?
You need the dev id. This was already discussed just a few posts ago.
The dev_id can be obtained at: http://www.youtube.com/my_profile_devThanks, Kmosabe - that certainly did the trick :o :). My advice is to put this URL to the first post of the thread, to avoid further comfusion about the dev_id 8)
Hi.
I have installed this mod in my cpg with the Lightbox mod (http://forum.coppermine-gallery.net/index.php?topic=35539.0) also.
In firefox everything works perfect but in IE explorer when i try to acces to the displayimage page of the youtube video i have this error message:
Internet Explorer cannot open the site http://www.grabadosplaza.es/displayimage.php?album=8&pos=2.
Operation aborted.
And when i press the ok button, it goes to a error page.
I have read on internet about this problem with IE, and i have found a lot of webs about this issue, but i am not sure what to change in the code to fix it.
One of the forums: http://channel9.msdn.com/ShowPost.aspx?PostID=215369
I need help. Thanks
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2007 Coppermine Dev Team
v1.1 originally written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.
********************************************
Coppermine version: 1.4.14
$Source$
$Revision: 3966 $
$Author: gaugau $
$Date: 2007-09-17 08:53:13 +0200 (Mo, 17 Sep 2007) $
**********************************************/
define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1); // Remove this if you edit this template until
// you have validated it. See docs/theme.htm.
// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='<img src="themes/AnimeZone/images/cellnav.gif" width="7" height="7" border="0" alt="" />';
// HTML template for the image navigation bar
$template_img_navbar = <<<EOT
<tr>
<td class="navmenu" align="left" style="padding-left:5px;"> <a href="{THUMB_TGT}" title="{THUMB_TITLE}">terug naar dit album</a> <b>|</b> <a href="javascript:;" onclick="blocking('picinfo','yes', 'block'); location.href='#fileinfo';return false;" title="{PIC_INFO_TITLE}">details</a> <b>|</b> <a href="{SLIDESHOW_TGT}" title="{SLIDESHOW_TITLE}">slideshow </a> <b>|</b> <a href="{ECARD_TGT}" title="{ECARD_TITLE}">eCard</a>
</a></td>
<td class="navmenu" align="right" style="padding-right:5px;">« <a href="{PREV_TGT}" title="{PREV_TITLE}">vorige</a> <b>|</b> <a href="{NEXT_TGT}" title="{NEXT_TITLE}">volgende</a> »</td>
</tr>
<tr>
<td colspan="2" align="center">
<strong><br />{PIC_POS}</strong>
</td>
</tr>
<!-- BEGIN report_file_button -->
<!-- END report_file_button --><!-- BEGIN ecard_button -->
<!-- END ecard_button -->
EOT;
// HTML template for the display of comments
$template_add_your_comment = <<<EOT
</table>
<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">
<tr>
<td class="tableh2_compact"><a name="respond"></a><span style="float: left;"><b>{ADD_YOUR_COMMENT}</b></span></td>
</tr>
<tr>
<!-- BEGIN smilies -->
<tr>
<td width="100%" class="tableb_compact">
{SMILIES}
</td>
</tr>
<!-- END smilies -->
<td colspan="3">
<form method="post" name="post" action="db_input.php">
<table width="100%" cellpadding="0" cellspacing="0">
<!-- BEGIN user_name_input -->
<tr><td class="tableb_compact">
{NAME}
</td>
<td class="tableb_compact">
<input type="text" class="textinput" name="msg_author" size="10" maxlength="20" value="{USER_NAME}" />
</td></tr><tr>
<!-- END user_name_input -->
<!-- BEGIN input_box_smilies -->
<td class="tableb_compact"><br />
{COMMENT}: </td>
<td width="100%" class="tableb_compact">
<textarea class="textinput" id="message" name="msg_body" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" style="width: 95%;" rows="3" cols=""></textarea></td></tr></table>
<!-- END input_box_smilies -->
<!-- BEGIN input_box_no_smilies -->
<td class="tableb_compact">
<textarea class="textinput" id="message" name="msg_body" style="width: 95%;" rows="3" cols=""></textarea></td></tr></table>
<!-- END input_box_no_smilies -->
<table align="center"><tr><td>
<input type="hidden" name="event" value="comment" />
<input type="hidden" name="pid" value="{PIC_ID}" />
<input type="submit" class="comment_button" name="submit" value="Bevestig" />
</td></tr></table>
</form>
</td>
</tr>
EOT;
// HTML template for title row of the thumbnail view (album title + sort options)
$template_thumb_view_title_row = <<<EOT
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>{ALBUM_NAME}</b></td>
</tr>
</table>
EOT;
// Displays a picture
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$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";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
);
return template_eval($template_display_media, $params);
}
?>
<?
ini_set("allow_url_fopen", 1);
ini_set("allow_url_include", 1);
...
ini_set("allow_url_fopen", 0);
ini_set("allow_url_include", 0);
?>
Nice scripts, however when uploading I got this messageCode: [Select]0 uploads were successful.
What's wrong with that?
___________edit____________
OMG! I just realized, I can't upload images/photos from the url as well, as I'm never use this one before (always using batch add)
_________________________
My bad, allow_url_fopen is off, I'll ask my hosting provider to change it.
upload.php, add this code near the top of the file after the commentsPlease can you explain this phrase...
if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change
What about other video providers?
Metacafe, Google etc. - There are many I know, but is there a code fix that would enable additional outside providers?
Also, before integrating this feature, I wish to confirm that:
1) This will allow registered members (as well as Admins) to upload videos from YouTube (or elsewhere if coded) in the same interface as images.
A) There are some sort of instructions built in (or do we need to code them in any way)
2) What about Coppermine upgrades?
A) Will future versions of Coppermine have this built in, or will we need to start over?
Thanks :)
You have broken about every rule associated to this forum you possibly can. Before posting you should read the rules you have agreed to when signing up for the forums such as hijacking a thread, asking more than one question in a thread, not bothering to read back through that thread for answers to some of your questions and not bothering with the search facility.Yeah, but can you imagine how it's hard to read miles of technic texts you hardly understand even in native language when you're not native English-speaker.... >:( >:( >:(
If you want people to help then try to do the basics for yourself and try and respect this boards policies.
What is "theme_html_picture"? And how can I "apply" it? To what apply?
What about other video providers?
Metacafe, Google etc. - There are many I know, but is there a code fix that would enable additional outside providers?
Also, before integrating this feature, I wish to confirm that:
1) This will allow registered members (as well as Admins) to upload videos from YouTube (or elsewhere if coded) in the same interface as images.
A) There are some sort of instructions built in (or do we need to code them in any way)
2) What about Coppermine upgrades?
A) Will future versions of Coppermine have this built in, or will we need to start over?
Thanks :)
Do I can to use this great mod with good version (some of last version) of PHP 4?
Yeah, but can you imagine how it's hard to read miles of technic texts you hardly understand even in native language when you're not native English-speaker.... >:( >:( >:(
If I could have an answer myself, I won't ask you(((
I haven't heard of anyone else with this issue. Did you test with several different youtube videos to make sure?
Post a link, test account with upload rights, and debug mode with notices enabled.
You have broken about every rule associated to this forum you possibly can. Before posting you should read the rules you have agreed to when signing up for the forums such as hijacking a thread, asking more than one question in a thread, not bothering to read back through that thread for answers to some of your questions and not bothering with the search facility.
If you want people to help then try to do the basics for yourself and try and respect this boards policies.
here is a link to the site http://www.halfmoonpub.co.uk/copper/thumbnails.php?album=3 (http://www.halfmoonpub.co.uk/copper/thumbnails.php?album=3) I have now gone through and copy and pasted in the discriptions for the first four I tried. but i have uploaded a few more with the same result no title and description
thanks
here is a link to the site http://www.halfmoonpub.co.uk/copper/thumbnails.php?album=3 (http://www.halfmoonpub.co.uk/copper/thumbnails.php?album=3) I have now gone through and copy and pasted in the discriptions for the first four I tried. but i have uploaded a few more with the same result no title and descriptionIntegration issues aside, I just followed this link and clicked on three of the thumbnails.
thanks
theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)
FindCode: [Select]if (isset($image_size['reduced'])) {
Change toCode: [Select]
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
If you get this message when you upload:
then your dev_id is probably wrong.
(if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)
// Displays a picture
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$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";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
);
return template_eval($template_display_media, $params);
}
function theme_html_img_nav_menu()
{
global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR ; //$PHP_SELF,
global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;
$cat_link = is_numeric($album) ? '' : '&cat=' . $cat;
$uid_link = is_numeric($_GET['uid']) ? '&uid=' . $_GET['uid'] : '';
$human_pos = $pos + 1;
$page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols']));
$pid = $CURRENT_PIC_DATA['pid'];
$start = 0;
$start_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$start";
$start_title = $lang_img_nav_bar['go_album_start'];
$meta_nav .= "<link rel=\"start\" href=\"$start_tgt\" title=\"$start_title\" />
";
$end = $pic_count - 1;
$end_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$end";
$end_title = $lang_img_nav_bar['go_album_end'];
$meta_nav .= "<link rel=\"last\" href=\"$end_tgt\" title=\"$end_title\" />
";
if ($pos > 0) {
$prev = $pos - 1;
$prev_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$prev$uid_link";
$prev_title = $lang_img_nav_bar['prev_title'];
$meta_nav .= "<link rel=\"prev\" href=\"$prev_tgt\" title=\"$prev_title\" />
";
} else {
$prev_tgt = "javascript:;";
$prev_title = "";
}
if ($pos < ($pic_count -1)) {
$next = $pos + 1;
$next_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$next$uid_link";
$next_title = $lang_img_nav_bar['next_title'];
$meta_nav .= "<link rel=\"next\" href=\"$next_tgt\" title=\"$next_title\"/>
";
} else {
$next_tgt = "javascript:;";
$next_title = "";
}
if (USER_CAN_SEND_ECARDS) {
$ecard_tgt = "ecard.php?album=$album$cat_link&pid=$pid&pos=$pos";
$ecard_title = $lang_img_nav_bar['ecard_title'];
} else {
template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard
/*$ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');";
$ecard_title = $lang_img_nav_bar['ecard_disabled'];*/
}
//report to moderator buttons
if (($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS)) {
$report_tgt = "report_file.php?album=$album$cat_link&pid=$pid&pos=$pos";
} else { // remove button if report toggle is off
template_extract_block($template_img_navbar, 'report_file_button');
}
$thumb_tgt = "thumbnails.php?album=$album$cat_link&page=$page$uid_link";
$meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']."\"/>
";
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link$uid_link&pid=$pid&slideshow=".$CONFIG['slideshow_interval'];
$pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);
if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
$location= $THEME_DIR;
} else {
$location= '';
}
$params = array('{THUMB_TGT}' => $thumb_tgt,
'{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'],
'{PIC_INFO_TITLE}' => $lang_img_nav_bar['pic_info_title'],
'{SLIDESHOW_TGT}' => $slideshow_tgt,
'{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
'{PIC_POS}' => $pic_pos,
'{ECARD_TGT}' => $ecard_tgt,
'{ECARD_TITLE}' => $ecard_title,
'{PREV_TGT}' => $prev_tgt,
'{PREV_TITLE}' => $prev_title,
'{NEXT_TGT}' => $next_tgt,
'{NEXT_TITLE}' => $next_title,
'{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',
'{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',
'{REPORT_TGT}' => $report_tgt,
'{REPORT_TITLE}' => $lang_img_nav_bar['report_title'],
'{LOCATION}' => $location,
);
return template_eval($template_img_navbar, $params);
}
function theme_html_rating_box()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR;
global $template_image_rating, $lang_rate_pic;
if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) return '';
$votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round($CURRENT_PIC_DATA['pic_rating'] / 2000, 1), $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
$pid = $CURRENT_PIC_DATA['pid'];
if (defined('THEME_HAS_RATING_GRAPHICS')) {
$location= $THEME_DIR;
} else {
$location= '';
}
$params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'],
'{VOTES}' => $votes,
'{RATE0}' => "ratepic.php?pic=$pid&rate=0",
'{RATE1}' => "ratepic.php?pic=$pid&rate=1",
'{RATE2}' => "ratepic.php?pic=$pid&rate=2",
'{RATE3}' => "ratepic.php?pic=$pid&rate=3",
'{RATE4}' => "ratepic.php?pic=$pid&rate=4",
'{RATE5}' => "ratepic.php?pic=$pid&rate=5",
'{RUBBISH}' => $lang_rate_pic['rubbish'],
'{POOR}' => $lang_rate_pic['poor'],
'{FAIR}' => $lang_rate_pic['fair'],
'{GOOD}' => $lang_rate_pic['good'],
'{EXCELLENT}' => $lang_rate_pic['excellent'],
'{GREAT}' => $lang_rate_pic['great'],
'{WIDTH}' => $CONFIG['picture_table_width'],
'{LOCATION}' => $location, //theme dir or default images directory
);
return template_eval($template_image_rating, $params);
}
//report to moderator buttons
I haven't tried it as I am currently on a work PC but try using the attached theme.php in your valentines theme.
Warning: Expected ':' but found '='. Declaration dropped.
Source File: http://womenmotorcyclist.com/community/cpg1418/displayimage.php?album=1&pos=4#top_display_media
Line: 0
theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)and I'd bet others would appreciate a clarification as to where to copy from and where to end.
You copy the entire theme_html_picture() function - that's everything from the opening brace at the start of the function to the corresponding closing brace at the end of the function. That's about 160 lines of code. It doesn't matter where in the file you put it, so long as you don't stick it in the middle of something else.
// YouTube Modification
// Displays a picture
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$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";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
);
return template_eval($template_display_media, $params);
}
// End YouTube Modification
Your theme doesn't display properly at all in IE but looks fine to me in FF. So, as a test I installed valentines with this mod to my test server and it worked perfectly. It also works perfectly on one of my sites which is also bridged with joomla but using a custom theme of my own.
As this works with IE on my install but not with yours (as I get the error on yours in IE) then it must be either something in your install (such as your bridge, plugins or even your hosts PHP settings) interfering with it or you have done something wrong in your upload.php or theme.php file. I used the theme.php file that I uploaded for you earlier so that sort of rules that out.
Your theme doesn't display properly at all in IECan you be more specific? Do you mean Joomla Theme or Valentines?
if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = $xmatches[1];
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
} else {
$YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
}
if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://gdata.youtube.com/feeds/api/videos/$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
//if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = "http://img.youtube.com/vi/$vid/0.jpg";
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
//} else {
// $YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
//}
// todo: parse the xml properly
preg_match('/<description>(.*)<\/description>/', $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<tags>(.*)<\/tags>/', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match('/<title>(.*)<\/title>/', $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
// todo: parse the xml properly
preg_match("/<media:description type='plain'>(.*)<\/media:description>/s", $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<media:keywords>(.*)<\/media:keywords>/s', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match("/<media:title type='plain'>(.*)<\/media:title>/s", $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
To update this mod for the new API, try the following:
You don't need to sign up for any key with this new API.
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'. $vid . '&fs=1&rel=0" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="350"></embed></object><br />';
&color1=0xcc2550&color2=0xe87a9f
Where the colors conform to your Coppermine theme...$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'. $vid . '&fs=1&rel=0&color1=0xcc2550&color2=0xe87a9f" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="350"></embed></object><br />';
To update this mod for the new API, try the following:
You don't need to sign up for any key with this new API.
You probably didn't edit upload.php correctly.
This mod allows you to embed Youtube videos in your Coppermine gallery. A new section appears on the upload page where you enter the URL of the video. Coppermine will use the video thumbnail and title/caption/keywords from Youtube when adding the video.
Demo: http://gelipo.com/members/Nibbler/pictures/61993
To use this mod you will need some extra things:
- Youtube dev API ID (http://www.youtube.com/dev then http://www.youtube.com/my_profile_dev)
- PHP URL fopen enabled
- Regular URI uploads need to be working correctly, right permissons etc.
Files to be changed: upload.php, theme.php
upload.php, add this code near the top of the file after the comments (you can skip this step if you have PHP5)Code: [Select]if (!function_exists('file_put_contents')) {
function file_put_contents($n,$d) {
$f=@fopen($n,"w");
if (!$f) {
return false;
} else {
fwrite($f,$d);
fclose($f);
return true;
}
}
}
Then findCode: [Select]// Add the control device.
$form_array[] = array('control', 'phase_1', 4);
before it, add
Code: [Select]// Youtube
if (USER_ID) {
$form_array[] = 'Youtube uploads';
$form_array[] = array('', 'YT_array[]', 0, 256, 3);
$form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
}
FindCode: [Select]//Now we must prepare the inital form for adding the pictures to the database, and we must move them to their final location.
before it, add
Code: [Select]// youtube
$YT_array = count($_POST['YT_array']);
if ($YT_array) {
$YT_failure_array = array();
for ($counter = 0; $counter < $YT_array; $counter++) {
// Create the failure ordinal for ordering the report of failed uploads.
$failure_cardinal = $counter + 1;
$failure_ordinal = ''.$failure_cardinal.'. ';
$YT_URI = $_POST['YT_array'][$counter];
if (!$YT_URI) continue;
if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://gdata.youtube.com/feeds/api/videos/$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
//if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = "http://img.youtube.com/vi/$vid/0.jpg";
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
//} else {
// $YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
//}
} else {
$YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> 'Failed to find video');
}
}
}
In the block of code above, you must replace xxxxxxxxxxx with your youtube developer id.
FindCode: [Select]
$zip_error_count = count($zip_failure_array);
After, addCode: [Select]
$YT_error_count = count($YT_failure_array);
FindCode: [Select]
// Create error report if we have errors.
if (($file_error_count + $URI_error_count + $zip_error_count) > 0) {
Change toCode: [Select]
// Create error report if we have errors.
if (($file_error_count + $URI_error_count + $zip_error_count + $YT_error_count) > 0) {
FindCode: [Select]
// Close the error report table.
endtable()
before it, add
Code: [Select]
// Look for YT upload errors.
if ($YT_error_count > 0) {
// There are URI upload errors. Generate the section label.
form_label("YT errors:");
echo "<tr><td>URI</td><td>Error message</td></tr>";
// Cycle through the file upload errors.
for ($i=0; $i < $YT_error_count; $i++) {
// Print the error ordinal, file name, and error code.
echo "<tr><td>{$YT_failure_array[$i]['failure_ordinal']} {$YT_failure_array[$i]['URI_name']}</td><td>{$YT_failure_array[$i]['error_code']}</td></tr>";
}
}
FindCode: [Select]
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
Change to
Code: [Select]
if (preg_match('/^youtube_(.*)\.jpg$/', $file_set[0], $ytmatches)){
$vid = $ytmatches[1];
$xdata = file_get_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml");
// todo: parse the xml properly
preg_match("/<media:description type='plain'>(.*)<\/media:description>/s", $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<media:keywords>(.*)<\/media:keywords>/s', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match("/<media:title type='plain'>(.*)<\/media:title>/s", $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
$form_array = array(
array($lang_upload_php['album'], 'album', 2),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1, $title),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length'], $description),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1, $keywords),
array('control', 'phase_2', 4),
array('unique_ID', $_POST['unique_ID'], 4),
);
} else {
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
}
theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)
FindCode: [Select]if (isset($image_size['reduced'])) {
Change toCode: [Select]
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
If you get this message when you upload:
then your dev_id is probably wrong.
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
There's a bug in the sample theme. In your theme.php find@Nibbler: I can see that you fixed that for cpg1.4.x in SVN, but the original line resides in cpg1.5.x as well (both sample theme and themes.inc.php). Should the same fix be applied there as well?Code: [Select]'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
change toCode: [Select]'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
Sorry another question....
I have the same problem like many others... Youtube video upload works perfectly but then I only get the jpeg.
I went through most of the pages but couldn't find what I did wrong.
attached my theme.php
Thanks a lot for your answer Nibbler!!
This is my gallery: http://www.shahrukhandkajol.net/fanart/
I only tried one video upload yet as you can see
// Youtube
if (USER_ID) {
$form_array[] = 'Youtube uploads';
$form_array[] = array('', 'YT_array[]', 0, 256, 3);
$form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
}
// Youtube
$form_array[] = 'Youtube uploads';
$form_array[] = array('', 'YT_array[]', 0, 256, 3);
$form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx
Means you didn't apply the changes to your theme properly or at all. Also possible you have a plugin that overrides the theme.
if (isset($image_size['reduced'])) {
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
Copy it to your theme.php! Or in German: Kopiere die Passage aus der Datei sample/theme.php in deine theme.php ::)
Don't speak German here! I just translated a very easy sentence that you don't understand many times before.
okey wenn ich das richtig verstanden habe,
ich soll die passage aus der sample thema php koppieren in mein igames theme.php ? richtig
nur was ist mit passage gemeint ? was muss ich genau in meiner igames / theme.php einfügen ?
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$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";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
);
return template_eval($template_display_media, $params);
}
(In German: kopiere das in deine theme.php und modifiziere es wie beschrieben.) $thumbnail = "http://img.youtube.com/vi/$vid/0.jpg";
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$thumbnail = "http://img.youtube.com/vi/$vid/0.jpg";
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $thumbnail);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FILE, $wh);
curl_exec ($ch);
curl_close ($ch);
fclose($wh);
$xurl = "http://gdata.youtube.com/feeds/api/videos/$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
//if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
will this be built into 1.5?No. But there will be a similar plugin.
I am also getting the error:
URI Error message
1. http://www.youtube.com/watch?v=o7hDh4gr4qU Failed to find video
I am sure that this is a valid video URL - I have tried several. What am I doing wrong? Thanks.
now what should i do ???In the first place you should decide if you want to use this or that (http://forum.coppermine-gallery.net/index.php/topic,58222.msg310071.html#msg310071) mod!
Can someone post how to do this in 1.5.2 please?http://forum.coppermine-gallery.net/index.php/topic,62704.0.html (I'm not sure if you can access that board. If not, you can checkout the Flash Media Player plugin from the svn.)
Can someone post how to do this in 1.5.2 please?cpg1.5.x goes unsupported as in "no support at all". Your question is a support question related to cpg1.5.x and therefor not allowed. Anyway, even if cpg1.5.x was supported already, you're not allowed to post that question - see Don't ask for other versions (http://forum.coppermine-gallery.net/index.php/topic,24540.0.html)
This mod allows you to embed Youtube videos in your Coppermine gallery. A new section appears on the upload page where you enter the URL of the video. Coppermine will use the video thumbnail and title/caption/keywords from Youtube when adding the video.
Demo: http://gelipo.com/members/Nibbler/pictures/61993
To use this mod you will need some extra things:
- Youtube dev API ID (http://www.youtube.com/dev then http://www.youtube.com/my_profile_dev)
- PHP URL fopen enabled
- Regular URI uploads need to be working correctly, right permissons etc.
Files to be changed: upload.php, theme.php
upload.php, add this code near the top of the file after the comments (you can skip this step if you have PHP5)Code: [Select]if (!function_exists('file_put_contents')) {
function file_put_contents($n,$d) {
$f=@fopen($n,"w");
if (!$f) {
return false;
} else {
fwrite($f,$d);
fclose($f);
return true;
}
}
}
Then findCode: [Select]// Add the control device.
$form_array[] = array('control', 'phase_1', 4);
before it, add
Code: [Select]// Youtube
if (USER_ID) {
$form_array[] = 'Youtube uploads';
$form_array[] = array('', 'YT_array[]', 0, 256, 3);
$form_array[] = 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx';
}
FindCode: [Select]//Now we must prepare the inital form for adding the pictures to the database, and we must move them to their final location.
before it, add
Code: [Select]// youtube
$YT_array = count($_POST['YT_array']);
if ($YT_array) {
$YT_failure_array = array();
for ($counter = 0; $counter < $YT_array; $counter++) {
// Create the failure ordinal for ordering the report of failed uploads.
$failure_cardinal = $counter + 1;
$failure_ordinal = ''.$failure_cardinal.'. ';
$YT_URI = $_POST['YT_array'][$counter];
if (!$YT_URI) continue;
if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = $xmatches[1];
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
} else {
$YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
}
} else {
$YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> 'Failed to find video');
}
}
}
In the block of code above, you must replace xxxxxxxxxxx with your youtube developer id.
FindCode: [Select]
$zip_error_count = count($zip_failure_array);
After, addCode: [Select]
$YT_error_count = count($YT_failure_array);
FindCode: [Select]
// Create error report if we have errors.
if (($file_error_count + $URI_error_count + $zip_error_count) > 0) {
Change toCode: [Select]
// Create error report if we have errors.
if (($file_error_count + $URI_error_count + $zip_error_count + $YT_error_count) > 0) {
FindCode: [Select]
// Close the error report table.
endtable()
before it, add
Code: [Select]
// Look for YT upload errors.
if ($YT_error_count > 0) {
// There are URI upload errors. Generate the section label.
form_label("YT errors:");
echo "<tr><td>URI</td><td>Error message</td></tr>";
// Cycle through the file upload errors.
for ($i=0; $i < $YT_error_count; $i++) {
// Print the error ordinal, file name, and error code.
echo "<tr><td>{$YT_failure_array[$i]['failure_ordinal']} {$YT_failure_array[$i]['URI_name']}</td><td>{$YT_failure_array[$i]['error_code']}</td></tr>";
}
}
FindCode: [Select]
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
Change to
Code: [Select]
if (preg_match('/^youtube_(.*)\.jpg$/', $file_set[0], $ytmatches)){
$vid = $ytmatches[1];
$xdata = file_get_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml");
// todo: parse the xml properly
preg_match('/<description>(.*)<\/description>/', $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<tags>(.*)<\/tags>/', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match('/<title>(.*)<\/title>/', $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
$form_array = array(
array($lang_upload_php['album'], 'album', 2),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1, $title),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length'], $description),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1, $keywords),
array('control', 'phase_2', 4),
array('unique_ID', $_POST['unique_ID'], 4),
);
} else {
$form_array = array(
sprintf($lang_upload_php['max_fsize'], $CONFIG['max_upl_size']),
array($lang_upload_php['album'], 'album', 2),
array('MAX_FILE_SIZE', $max_file_size, 4),
array($lang_upload_php['picture'], 'userpicture', 1, 1),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),
array('event', 'picture', 4)
);
}
theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)
FindCode: [Select]if (isset($image_size['reduced'])) {
Change toCode: [Select]
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
If you get this message when you upload:
then your dev_id is probably wrong.
I have exactly the same problem here! Plz help me to fix this problem.
Problems "browse upload"...
YouTube upload working very fine, but "normal browse uploads" not working...
i select "Upload" and browse my computer picture, and click "Continue"...
(http://img166.imageshack.us/img166/6245/gallery1bd3.gif)
Now come problems.... look image...
(http://img250.imageshack.us/img250/1271/gallery2hi0.gif)
And now i click "Continue" so image no uploads my gallerys...
Upload return back first towards...
(http://img176.imageshack.us/img176/4689/gallery3df0.gif)
Thank you very much! ;)
Supplement is my upload.php file....
if (isset($image_size['reduced'])) {
if (preg_match('/^youtube_(.*)\.jpg$/', $CURRENT_PIC_DATA['filename'], $ytmatches)){
$vid = $ytmatches[1];
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'. $vid . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'. $vid . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';
} elseif (isset($image_size['reduced'])) {
$ CURRENT_PIC_DATA ['html'] = $ pic_html;
$ CURRENT_PIC_DATA ['header'] ='';
$ CURRENT_PIC_DATA ['footer'] ='';
$ CURRENT_PIC_DATA ['html'] = $ pic_html;
$ CURRENT_PIC_DATA ['header'] = $ pic_html;
$ CURRENT_PIC_DATA ['footer'] = $ pic_html;
i think everything was done but the problem is that i'm getting following error
''Error Report
The following uploads encountered errors:
YT errors:
URI Error message
1. http://www.youtube.com/watch?v=tbZDjnWtK1A''
now what should i do ???
the box appears in upload and i give it uri/URL , but that error occurred .
To update this mod for the new API, try the following:
findCode: [Select]if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=xxxxxxxxxxx&video_id=$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = $xmatches[1];
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
} else {
$YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
}
change toCode: [Select]if (preg_match('/youtube\.com\/watch\?v=(.*)/', $YT_URI, $matches)){
$vid = $matches[1];
$xurl = "http://gdata.youtube.com/feeds/api/videos/$vid";
$xdata = file_get_contents($xurl);
file_put_contents($CONFIG['fullpath'] . "edit/yt_$vid.xml", $xdata);
// todo: parse the xml properly
//if (preg_match('/<thumbnail_url>(.*)<\/thumbnail_url>/', $xdata, $xmatches)){
$thumbnail = "http://img.youtube.com/vi/$vid/0.jpg";
$rh = fopen($thumbnail, 'rb');
$wh = fopen($CONFIG['fullpath'] . "edit/yt_$vid.jpg", 'wb');
while (!feof($rh)) fwrite($wh, fread($rh, 1024));
fclose($rh);
fclose($wh);
$escrow_array[] = array('actual_name'=>"youtube_$vid.jpg", 'temporary_name'=> "yt_$vid.jpg");
//} else {
// $YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
//}
Then findCode: [Select]
// todo: parse the xml properly
preg_match('/<description>(.*)<\/description>/', $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<tags>(.*)<\/tags>/', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match('/<title>(.*)<\/title>/', $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
Change toCode: [Select]
// todo: parse the xml properly
preg_match("/<media:description type='plain'>(.*)<\/media:description>/s", $xdata, $xmatches);
$description = substr($xmatches[1], 0, $CONFIG['max_img_desc_length']);
// todo: parse the xml properly
preg_match('/<media:keywords>(.*)<\/media:keywords>/s', $xdata, $xmatches);
$keywords = $xmatches[1];
// todo: parse the xml properly
preg_match("/<media:title type='plain'>(.*)<\/media:title>/s", $xdata, $xmatches);
$title = substr($xmatches[1], 0, 255);
You don't need to sign up for any key with this new API.
//} else {
// $YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
//}
migzy...
Fancy sharing how you managed to get it to work, because I still have the exact same problem. fopen allowed, but get that YT error.
Adden
migzy...
Fancy sharing how you managed to get it to work, because I still have the exact same problem. fopen allowed, but get that YT error.
Adden
migzy...
Fancy sharing how you managed to get it to work, because I still have the exact same problem. fopen allowed, but get that YT error.
Adden