forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Uploading => Topic started by: Nibbler on October 31, 2006, 03:42:27 am

Title: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on October 31, 2006, 03:42:27 am
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:


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 find

Code: [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';
}
         
         
Find         

Code: [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.
     
Find

Code: [Select]
     
     $zip_error_count = count($zip_failure_array);

After, add

Code: [Select]
     
      $YT_error_count = count($YT_failure_array);
     
Find

Code: [Select]
   
        // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count) > 0) {
   
Change to

Code: [Select]
   
        // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count + $YT_error_count) > 0) {
     
Find

Code: [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>";

            }

        }
       
Find

Code: [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)

Find

Code: [Select]
if (isset($image_size['reduced'])) {

Change to

Code: [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:

Quote
     
        1YouTube internal error. Please report this issue -- including the exact method of producing this error -- to YouTube.

then your dev_id is probably wrong.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: freynolds on October 31, 2006, 03:45:25 am
THANKS!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Gilbert on October 31, 2006, 10:32:45 am
Thanks, I'll try that next week.
I was also busy with a solution but yours is more professional and with euchm neat code, and I hadn't a solution for the thumbnails.

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ninocass on October 31, 2006, 04:59:33 pm
Many thanks for the time you have spent coding this :)

However im getting the following error:

Code: [Select]
Fatal error: Call to undefined function: file_put_contents() in /home/fhlinux192/n/nino.fruitvalestudios.com/user/htdocs/gallery/upload.php on line 2064

Many thanks

Antonio
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on October 31, 2006, 06:03:16 pm
You don't have PHP5 - read what I said.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Iced Coffee on November 01, 2006, 07:51:51 am
What about photobucket.com? Can I link videos from photobucket the same way? or what should I modify?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 01, 2006, 01:53:09 pm
No idea.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: netager on November 02, 2006, 02:57:15 am
Great forum here - I found all answers here even without registration... :)
Quote
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.
Thanks :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 02, 2006, 02:59:15 am
Try adding this code into the top of upload.php

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;
  }
}
}
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Iced Coffee on November 02, 2006, 04:34:06 am
No idea.

Too bad for me then as I prefer to use photobucket. youtube is good but they reduce the quality of the movies badly.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: netager on November 02, 2006, 04:44:39 am
Nibbler, thank you :) That was quick.
I'll try it tomorrow and report how it works :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Pascal YAP on November 02, 2006, 09:16:47 am
Displaying videos from Youtube in Coppermine in French.

Morning Nibbler, All ozers,

  This MOD/HACK in our French board (http://forum.coppermine-gallery.net/index.php?topic=37970.msg179021#msg179021) (in French)

Thanx

PYAP
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: netager on November 03, 2006, 03:35:40 am
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
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: kegobeer on November 03, 2006, 03:42:07 am
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

You didn't.  Review your changes and make sure you did everything correctly.  Most likely you forgot a curly bracket or a semicolon somewhere.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 03, 2006, 03:46:03 am
Actually, I did. I have modified my previous post with the fix.

http://forum.coppermine-gallery.net/index.php?topic=37962.msg179381#msg179381
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: netager on November 03, 2006, 05:05:27 am
Thenk you :) Now it works! Awe-e-e-esome :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: h4nh4n on November 04, 2006, 09:13:47 am
Nice scripts, however when uploading I got this message
Code: [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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: h4nh4n on November 05, 2006, 02:10:44 pm
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
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: h4nh4n on November 06, 2006, 09:18:03 am
Hi Nibbler, I guess mine has a problem now... After I installed this mod I can't use batch-add anymore...

When I selected the folder in batch-add, the thumbnail didn't show up, but the links to images are working fine... When I tried insert to an album I got an error message saying "click for details or to reload" I clicked and nothing changes.

Have you test yours one? or maybe its only happened to me?

__________________________
And another one, does it effect to sitemap as well? http://www.cariartis.com/sitemap.php <<< check this out, I just realized when I visited google.com/webmaster and suprised an error with my sitemap...
Code: [Select]
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.



h4nh4n
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 06, 2006, 12:31:50 pm
You probably added some whitespace at the end of your theme.php by accident.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: h4nh4n on November 06, 2006, 01:18:41 pm
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
Code: [Select]
define('THEME_IS_XHTML10_TRANSITIONAL',1); and works fine now.

Thanks :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Quinttindew on November 08, 2006, 05:15:35 pm
 I have install the mod , but , I upload an video , But I get only the jpg and not the video


Title: Re: Displaying videos from Youtube in Coppermine.
Post by: h4nh4n on November 08, 2006, 06:24:03 pm
I have install the mod , but , I upload an video , But I get only the jpg and not the video



I have the same problem before, I just re-do editing for theme.php and now its works perfect.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Quinttindew on November 08, 2006, 07:14:42 pm
Hi How you mean exactly , i dnt understand It

grteets
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mywedding on November 10, 2006, 09:42:26 am
i took youtube code and then i put the codes ....

and i changed all of you wrote of codes for  coper.. 1.4.5 ,
 but , it seems upload an video with no error ,  But I get only the jpg and not the video

could you help me pls....i did read all your advice , bu ti can't...

its my copermine pages address http://www.dugunum.com/Gelin-Fotograflari/

best regards
dugunum
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 10, 2006, 12:08:23 pm
You probably missed the edit to theme.php
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mywedding on November 10, 2006, 01:40:56 pm
i try again,
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mywedding on November 10, 2006, 02:01:48 pm
its ok...

but i changed different "theme.php" ....its was in the "include" , what i change..
http://www.dugunum.com/Gelin-Fotograflari/displayimage.php?&pos=-3103

well , many thanks for your greet copprmine script to all of your team , who worked for that...

i love coppermine..

bye from istanbul ,which is magnificent city...

i try again,
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on November 10, 2006, 07:14:50 pm
You mustn't edit include/themes.inc.php!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phpbbguy on November 11, 2006, 05:26:24 pm
when you say
theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)

do you mean everything after that bit of code? am using eyeball and am missing that bit of code, so should i copy the whole code from sample theme into the eyeball theme?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on November 12, 2006, 10:40:18 am
If the function is not in your custom theme, this is what you need to paste in (into a new line before ?>):
Code: [Select]
// 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&amp;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);
}
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: compexsistemas on November 15, 2006, 05:56:54 pm
Hello, I use Dreamhost… and fopen cannot be qualified (off)… is no form to make work this mod? for example using cURL? Thanks and greetings from Argentina!  ???
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 15, 2006, 07:19:16 pm
See the instructions they provide you - http://wiki.dreamhost.com/index.php/CURL#Alternative_for_file_get_contents.28.29
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: capecodgal on November 15, 2006, 09:41:08 pm
really dumb question- but I have to ask.... I am not at home now so I can't test.......

when doing this will your server be hosting the videos or will you tube still be hosting them? In other words are you uploading the videos to your own server or are you streaming them off their servers?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 15, 2006, 09:47:11 pm
They remain at youtube. Only the thumbnail is copied to your gallery.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: capecodgal on November 16, 2006, 05:13:44 pm
They remain at youtube. Only the thumbnail is copied to your gallery.


Sweet! Thanks Nibbler  ;D
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bitcloud on November 29, 2006, 04:03:02 am
Hey guys,

This mod is working beautifully, but I'm finding users are getting images and youtube videos confused.
I wanted to add a watermark to youtube vids on this mod to quell this confusion...

So far I've got:
Code: [Select]
$cmdline = 'composite -compose over -gravity southeast "youtubewatermark.png" "tmp.jpg" '.'"tmp.jpg" 2>&1';
exec($cmdline);

I've pulled this from an old bit of code, and honestly can't remember the details of it (whether you need to declare anything to get the imagemagick commands working etc? I don't think so)
Anyway, I don't really know where to integrate this into this mod, and if/how I need to adjust it to get it working correctly.

Does anyone have any clues on this? It would be greatly appreciated! cheers
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: donnoman on November 29, 2006, 04:17:48 am
Your probably going to run into problems, if your host is running any kind of safe mode you won't be allowed to shell out, and many hosts don't have imagemagik installed.

Are you sure you have access to imagemagik?

You might look for some gd2 examples. 

also you might consider downloading the cpgmark plugin from cpg-contrib.org, it uses gd2 to do watermarking that you could use as an example.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bitcloud on November 29, 2006, 04:52:00 am
yeah I've got imagemagick working - that "composite" line of code is working in another upload php file...

I'm not really sure where in this mod to try and execute it tho...
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: KrustyTK on November 29, 2006, 11:38:44 pm
BRILLIANT!!!

Thank you verry much for this.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Justttt on December 10, 2006, 04:09:45 pm
how cpomes when i have added this code i get this error

Parse error: syntax error, unexpected $end in /home/www/trippyEUi/album/upload.php on line 2775

but i dont have this line ??.

i have reveiwed the code and dont see any mistakes.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Justttt on December 10, 2006, 04:53:36 pm
it wil not let me edit my last post , but that problem is solved i just took out the first step ..
but now when i try to upload a youtube vid i get this error

Fatal error: Call to undefined function: file_put_contents() in /home/www/trippyEUi/album/upload.php on line 2087
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 10, 2006, 05:03:18 pm
There was a typo in the first step, try again.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Justttt on December 10, 2006, 07:58:41 pm
right i have that bit sorted now . but when i upload a youtube link . it only becomes a jpg. i have read this topic and still no help . if i upload the theme.php could sombody please hlep me. thanks in advance
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 10, 2006, 09:40:55 pm
You have not applied the mod to that file as far as I can see.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Justttt on December 11, 2006, 09:03:52 am
ahh right i see. i have now added the code to the theme.php . but now instead of a jpg. i get a white box with nothing there  ???
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 11, 2006, 01:34:06 pm
Looks ok to me, do you have a flash plugin installed?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: enver on December 13, 2006, 01:02:42 pm
thanks  ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Pascal YAP on December 13, 2006, 08:14:11 pm
Morning,

I'm tryng to play with this mod on Funpic.org
Unfortunately, i get an error just after enter video's URL (like h t t p://www.youtube. com/watch?v=kritugh8ks

CPG said :
0 uploads were successful.
YT errors:
URI                                                  Error message
1. h t t p://www.youtube. com/watch?v=kritugh8ks

And no Error message

Perhaps Funpic.org do not have fopen in action !

Phpinfo() said : allow_url_fopen   Off
Bad luck !

PYAP
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: sigepjedi on December 15, 2006, 02:27:16 am
I use the hardwire theme, and i know you said to copy the code from the sample theme.php, but there is a considerable difference in the two...

simply replacing it doesnt work... adding the function doesnt work, and there isnt any similar functionality location to add it into on my hardwired theme.php...

please advise!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: sigepjedi on December 15, 2006, 02:38:52 am
I missed your post on page 2... added that function before ?> and atleast now my theme file saved works..

Though, upon upload I got the following:

Quote
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

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mrairbrush on December 25, 2006, 06:20:44 pm
It works fine but i dont have a file names themes.php, online a file names themes.inc.php in includes.
No youtube uploads working but no jpeg upload. when i upload an jpeg and change the site to order the jpeg to albums there an upload search button again.

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mrairbrush on December 25, 2006, 06:33:11 pm
The error is in the upload.php
When i works with the original file the upload of jpeg is ok. With the edit file for youtube it works wrong an i cant upload jpegs
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Topfrog007 on December 27, 2006, 12:33:01 am
Hello Nibbler! First off a big thanks to you for producing this. I've searched for what seems like ages trying to find some way that I could have a "YouTube gallery" on my site. I was just about to purchase a program when I found this thread.

I have Coppermine and decided to give this thread a shot. I edited the upload.php and theme.php to your specifications. When I go to upload a file, and put in the entire youtube address I get this error " HTTP/1.0 200 OK ". I can't seem to figure out what is causing this problem.

Can you help me?

Excellent job on Coppermine BTW.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 27, 2006, 12:50:23 am
Did you put the link into one of the 2 new youtube boxes or the standard URI boxes?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Topfrog007 on December 27, 2006, 07:15:12 am
Hmm... I don't see that... All I have is the File Uploads: and the URI/URL uploads.
I'm guessing I missed something in the upload.php??
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Topfrog007 on December 27, 2006, 08:46:00 am
Ok I went over it and got it the Youtube upload options to show up. Whenever I try to upload I get a blank box in the error message, but it says upload unsuccesful. Any thoughts?

And thanks for your time.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Topfrog007 on December 27, 2006, 09:06:28 am
I've gone through the tutorial twice since my last post, re-done everything and still can't figure out what the problem is. When I try to submit a Youtube video I get an upload unsuccessful but the error box is just blank. The site is www.Politicalrundown.com ... Is it possible to just post the correct upload.php and theme.php files?

Regards,
Preston
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Topfrog007 on December 30, 2006, 08:55:37 am
Please will someone help me get my gallery working? I'm willing to pay a small ammount... contact me through PM please!!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mrairbrush on January 02, 2007, 06:34:39 pm
can you updating or extend this hack for playing videos from googlevideo or myvideo?
Youtube needs an developerid, googlevideo also.
This were great
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on January 03, 2007, 12:39:08 am
Attached is a modded version of upload.php that allows you to use the mod on servers without URL fopen support. You must however have cURL available instead.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Pascal YAP on January 03, 2007, 02:26:13 pm
Nibbler,

My host do not allow fopen;
I'll try in  few minutes your new upload.php... and i wish it's good news for my Funpic.org host  ;)

PYAP
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: carlo1 on January 06, 2007, 07:36:11 pm
i used your upload.php and the theme.txt a few answers before. i changed .txt to .php and uploaded the 2 new files. no i go to upload new pics, after pressing the upload button i get this error:
Fatal error: Call to undefined function curl_init() in /srv/www/httpd/phost/h/de/pytalhost/xxx/web/cpg141/upload.php on line 37

my upload.php looks like this:
starting with line 36:
function file_get_contents_curl($url) {
   $ch = curl_init($url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   $content = curl_exec($ch);
   curl_close($curl_handle);
   return $content;
}


i hope you can help me, i also need a hack for google video.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on January 06, 2007, 08:47:17 pm
You must however have cURL available instead.

You don't have cURL available, so you can't use it.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: carlo1 on January 06, 2007, 08:55:51 pm
what i must do now? i follow the instruction on site one, but i doesn´t work. can somewhen send me a correct upload.php so i must only chance the ID.

thank you.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: carlo1 on January 07, 2007, 02:53:26 am
the upload.php works now but if i change the theme.php i get a new error.
i paste your code at the end of the side.
Template error
Failed to find block 'report_file_button'(#(<!-- BEGIN report_file_button -->)(.*?)(<!-- END report_file_button -->)#s) in :

you can see it here. http://hoelzlmani.pytalhost.de/cpg141/displayimage.php?album=200&pos=0 (http://hoelzlmani.pytalhost.de/cpg141/displayimage.php?album=200&pos=0)

If i use the theme.txt from before, i can see the video but the site looks confused.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on January 07, 2007, 03:03:40 am
Make the change correctly and you won't get an error message...
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: flux on January 12, 2007, 03:09:17 pm
hi,

i've tested this code on my invision1.3 bridged cpg and it seems something's going wrong at some point..

well "uploading" youtube videos works okay but the video info (keywords, description..) is not parsed and inserted in the final upload form

i've tried to follow the upload process and as far as i've understood how it works, i found out that the parsing code block is never processed because it won't enter the following test block :

Code: [Select]
    if(USER_UPLOAD_FORM == '0') {

        // The user should have the 'single upload only' form.

what should be the group upload conf in order to get an USER_UPLOAD_FORM set to 0 ?

that's probably just a detail but i'd like to fix it..
thx


####

I've fixed the problem and post my modifications here shortly
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: flux on January 13, 2007, 09:39:34 am
okay so here are the modifications i made to my upload.php in order to get the youtube video data working :

those modifications won't break the original hack so you can/have to apply the original hack along with this if you want it fully operational

locate :

Code: [Select]
       
        if ($CONFIG['read_iptc_data']) {
   $iptc = get_IPTC($path_to_image);
        }

replace it with :

Code: [Select]
    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);
                }

- OPTIONAL -
Now if you want to fetch more data from youtube (duration, view count, youtube upload time, our update time) you can use the following code.
Unless you make your own modifications to other (theme) scripts that data won't be used at all !
I use the "user4" user picture data field to store that data. The user data field name does not need to be set, it can be left empty so it won't appear on the upload forms or in the picture info table.
Needless to say that if you "user4" field is in use it will mess things up.. Of course you can use any other userX data field if you know how to change that bit of code.. (replace all "user4"/"field4" you see by your "userX"/"fieldX" value)

Locate :
Code: [Select]
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.

Replace it with :
Code: [Select]
// 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'])) {

the data is stored in the following format : duration_seconds|youtube_view_count|youtube_upload_time|cpg_update_time (ex: 54|95|1168283825|1168676023)


- BUGFIX -
okay there is one tiny bug in the original hack, it may have been discussed/fix elsewhere/before but i had to fix it in my script so..
The bug is the following : the xml file containing all the youtube data is not deleted after the video is added to the gallery.

Locate:
Code: [Select]
        // First, we delete the preview image.
        if ((!strstr($preview_path, 'thumb')) and (file_exists($preview_path))) {

            unlink($preview_path);

Insert BELOW:
Code: [Select]
// 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");
}
}


- Known unfixed BUG -
Using the hack to test my modifications i also found another bug.
If you upload the same video twice, the upload process will succeed without errors (preview & thumbs ok) but the actual video won't work because cpg upload process will change the "picture" filename of the video in order not to overwrite the existing one and so it will also change the url of the video, pointing to a non existing video.

well that's about it
hope it helps..
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Tai on January 31, 2007, 09:53:55 pm
Just like to add a thanks for this hack Nibbler.

It worked flawlessly and is a great addition to the site.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: puku on February 02, 2007, 06:58:39 pm
Hi,
first I have to say well done this is realy great hack ... thanx
and now my question: can I allow Guests to upload YouTube "links" somehow ?? because this works great but the YouTube uploads fields are displayed only for registered users ...
thank you
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 02, 2007, 08:10:29 pm

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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: puku on February 03, 2007, 04:32:01 pm
Change that section to set permissions. Remove the USER_ID check if you want to allow anyone to use it.

great, thank you  :)
great mod, great technical support  ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jape on February 03, 2007, 07:00:46 pm
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....
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: thrower on February 17, 2007, 02:12:00 am
I am very new to this stuff but have successfully put together a Joomla website with Coppermine integrated.  I have tried to implement this code for YouTube functionality but it is not working correctly.

I would really appreciate any advice here to get this to work.  To start with, I have added all of the code but when I go to the upload screen I do not see a separate section for Youtube videos.  I only have the file section and URI/URL section. 

Also, I'm not sure if I altered the right theme.php file.  I switched my configuration to use the classic theme and altered the theme.php file in the classic directory.

Thank you in advance for any help!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: thrower on February 17, 2007, 08:54:06 pm
I have figured out quite a few things since my last post but I'm currently stumped.  Can someone please help with this problem? 

I can upload Youtube videos and I get an upload successful message after doing so.  When I select 'continue' to add the file information I get the following error box:  "The previous file could not be placed.  You have successfully placed all files." 

I can successfully upload files from the browse function and also from the URL/URI function.  I have two Coppermine installations that I have been trying this on.  The first one is just a straight Coppermine install.  I have gotten everything to work successfully for this one and it works great!  The second one is the CoppermineVis install that is integrated with Joomla, this is the actual one I plan to use for my site.  I should also mention that I have utilized the upload.php file posted above by Nibbler.  This functionality and the Coppermine software is great so far, I hope someone can help as it appears I am close.  Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: vascodx on February 25, 2007, 04:24:25 pm
Great mod!!! No problem on installation. Thanks!!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ashelby on February 28, 2007, 03:29:22 am
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

It would be nice if you could add what you did.  Chances are someone else, LIKE ME. Has the same confusion.  :)  Which themes should we be changing, there are sever in the themes folder, should we change each one?  Or is their a global one somewhere?  Thanks.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 28, 2007, 02:07:56 pm
Change the theme you use
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ashelby on February 28, 2007, 02:40:38 pm
Thank you nibbler.  I figured it out last night and was going to post up here this morning.

It just needs be changed in the theme you are using, themes/clasic/theme.php in my case.

Now to change the CSS to match my site and then I'll post a link.

The YOUTUBE mod works GREAT by the way.  It may not be used to much for what I am making, but it is still really neat.  I had the dev account setup in about 2 minutes at youtube and all the coding to the theme.php done in about 5 minutes.

I use godaddy and they run php 4 by default, so I used the code you added for php 4 and it worked fine.  Then I saw godaddy.com will let you upgrade your account to run the php 5 through the control panel there.  Takes 24 hours to get changed, so I may need to go back and take out that php 4 code I added. 

Off to mod, thanks again!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ashelby on February 28, 2007, 05:52:30 pm
Does this actually upload the youtube file to my server?  Or is it linking to youtube?  I'm looking around the coppermine forums and it is a question I am curious of.  I read there is no remote storage option for coppermine, does this hack null that.  This might be another subject all together, but would it be possible to feed video through coppermine from other sites.  Take a url from somesite.com/videos/video_x.wmv and play that video on the coppermine page without storing the file locally.

I am looking at this for my site  (http://www.video-tutorials.com/cmine/) and giving away the original URL is no problem, in fact I want it displayed for credit purposes and I've added a field for the video creator to put their website address on every video.

Thanks the excellent support and excellent script,

Aric
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 28, 2007, 06:16:40 pm
A already answered this question - it is just a link. The thumbnail is copied to the server but that is all.

You can add code to stream videos from anywhere you like.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ashelby on February 28, 2007, 06:47:25 pm
Awesome, I will take a much closer look at your code today (I have the YOUTUBE working) and see if I can massage it into what I need. 

Any quick tips on doing this?

This really helps my effort.  I was getting frustrated with godaddy's file size limits.

I will post what I can figure out on changing the godady limit to 8MB, as well as the streaming other formats.

Aric

video-tutorials.com (http://www.video-tutorials.com)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: webslingers on February 28, 2007, 09:14:50 pm
I have put in all the code, can upload a youtube video fine, but when it comes to display on the theme, there is only a small thumbnail. Clicking on the thumbnail does nothing. Can someone tell me where I may have messed up? I've tried using a upload.php from a working source which tells me it might be a server thing. Thanks for any help.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 28, 2007, 09:20:22 pm
You probably missed the change to your theme. post your code.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ashelby on February 28, 2007, 09:21:52 pm
Yes, I had the same when I switched themes.  You have to make the changes in every theme.php file or you will just get the thumbnail.

Aric
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: P1mm3l4ug3 on February 28, 2007, 11:49:50 pm
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
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: webslingers on March 01, 2007, 12:29:28 am
I uploaded the script to my production server to work out all the bugs there and not have to do it twice. All works well until I go to view the newly uploaded video. I get a white box. www.frankandmarywatson.com/vids

I have entered the code to work with PHP4 and made all the needed chmod adjustments.

Thank you.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 01, 2007, 12:35:46 am
You have some issue with duplicate files. Add a video you have never added before.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: webslingers on March 01, 2007, 12:43:11 am
You have some issue with duplicate files. Add a video you have never added before.

Ok, I uploaded a new video and it worked. Awesome! How do I clear all the history of all vids to start over? Is there a way to dissallow or change dup uploads?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 01, 2007, 12:47:00 am
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)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: webslingers on March 01, 2007, 01:04:26 am
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)

and those are in albums/userpics/xxx   ?

I've delete those, didn't fix the white vids. Did I miss something?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 01, 2007, 01:13:15 am
It won't fix existing problems. It will stop it happening for future videos.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: webslingers on March 01, 2007, 01:24:07 am
It won't fix existing problems. It will stop it happening for future videos.

Ok, that works for me. Seems to have done the trick. I have one more question. Is it my understanding that if you have private vids only, this is not for you? There is no way to add the site as a user somehow and allow viewing of private vids?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 01, 2007, 01:26:30 am
I don't know.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: webslingers on March 01, 2007, 01:29:12 am
Ok, so it works great! Thank you for this!

If anyone has info on how to display private vids on your website without the user being logged into youtube as well, that would be great information. Maybe the site can have an open session with youtube and be listed as a friend somehow...? What are the thoughts on this? Can it be done?

Thanks Nibbler... Thanks to anyone else who posts!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: P1mm3l4ug3 on March 01, 2007, 10:20:53 am
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


aNY iDEA
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ashelby on March 01, 2007, 02:08:04 pm
Nibbler has explained this, you are probably uploaing duplicate files.  Try uploading something you have never uploaded before and see if it comes out successfully.  If it works, then you should just have to change the file names for uploading the duplicate files.

Aric
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: P1mm3l4ug3 on March 02, 2007, 09:24:06 am
its not an duplicate file i have test it with many different video's and pictures

its always the same message

upload ok, i choose the album and the title and then

The previous file could not be placed.

You have successfully placed all the files.

and the files are 100% not a duplicate
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: P1mm3l4ug3 on March 02, 2007, 09:30:47 am
Here is my Upload.php file

possibly anyone can find the error i build in, in the script ;D
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bitcloud on March 22, 2007, 04:32:39 pm
Nice work flux! thats a very slick addition to this mod...
Have you found any way around the duplicate upload bug?

Also, has anyone had any luck adding a watermark to youtube videos?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: webslingers on March 30, 2007, 11:26:07 pm
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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: morgue on April 13, 2007, 08:44:44 am
If you get this error, there is probably a space after your Developer ID.

Hi, there's no space and I'm getting this error, any suggestion?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: morgue on April 13, 2007, 08:48:41 am
I'm not getting that "4Missing required parameter" though, all I get is
YT errors:
URI   Error message
1. http://www.youtube.com/watch?v=7PZK8koGcmM

I get nothing, I tried uploading using random videos, using watch?v=myDevID...

I am getting the youtube upload videos but I don't know... Am I supposed to set something up on user groups? If so, I am not getting any option there...
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: dakwah on April 19, 2007, 10:28:13 pm
I got a problem, when i tried to upload a file, i got the upload.php file pop-up asking me to open or save. When i open it, it is just a blank file.

why and how to overcome this?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: MaverickLal101 on April 22, 2007, 01:28:10 am
oh boy i tried this and got a host of problems...

i think i got the stuff in themes.php fine, i understood what u meant about copying and pasting tat function over but my upload.php...

lol... take a look...
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jujuv on May 15, 2007, 10:23:05 pm
Excuse me for my bad english ... I'm french

I have a problem with the website's skin when I look a video !
My website has a left column and a total width of 950px and when I look a video the width is so large !!!

I think that the MOD isn't make for a skin with a left column !?!
my website: http://www.wallmanga.com
a page with video: http://www.wallmanga.com/galerie/displayimage.php?pos=-20305
and
a page with photo: http://www.wallmanga.com/galerie/displayimage.php?pos=-19156
for difference of width

Thanks

PS: In the French Forum, They have no time for me for the moment  ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on May 16, 2007, 03:11:33 am
Youtube's videos are 425x350. If you want them a different size then go ahead and adjust the code, but they will probably become distorted if you do.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jujuv on May 16, 2007, 11:01:33 am
I found the problem !!!

Look the picture !

Code: [Select]
$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\">';
I removed <table align=\"center\"> and it's ok !

Thanks for help  ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: olti on May 28, 2007, 11:28:51 am
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!  ;)

I have exactly the same problem here! Plz help me to fix this problem.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: olti on May 28, 2007, 11:35:05 am
Here is my upload.php file


         
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: The Reverend Doctor on June 15, 2007, 04:16:15 pm
On the "uploads page" the "YouTube Uploads" space appears and works fine.  But after it uploads you only see the JPEG of the video, it won't play.

Here is my site http://ntsshow.com/coppermine_dir/displayimage.php?album=20&pos=0

The pic of the little girl is supposed to be a playable YouTube video

Any help is appreciated.

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on June 15, 2007, 04:36:56 pm
You probably missed the changes to the theme.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: The Reverend Doctor on June 15, 2007, 07:15:04 pm
Okay, I had overlooked the theme.php in the "rainy day" directory.  But here is the problem now.  The theme.php in the "sample" directory has this line of code in my rainy day theme.php? 

if (isset($image_size['reduced'])) {

But my theme.php in my "rainy day" directory does not.  My question is where should I insert the line of code

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'])) {


Here is the entire code for my "rainy day" theme.php

Thanks


<?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.8
  $Source$
  $Revision: 3116 $
  $Author: gaugau $
  $Date: 2006-06-08 00:11:54 +0200 (Do, 08 Jun 2006) $
**********************************************/

// ------------------------------------------------------------------------- //
// This theme has had all redundant CORE items removed                           //
// ------------------------------------------------------------------------- //

define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);
define('THEME_HAS_NO_SUB_MENU_BUTTONS', 1);

// HTML template for sys_menu
$template_sys_menu = <<<EOT
  <div class="topmenu">
          <table border="0" cellpadding="0" cellspacing="0">
                  <tr>
  {BUTTONS}
                  </tr>
          </table>
  </div>
EOT;

// HTML template for template sys_menu buttons
$template_sys_menu_button = <<<EOT
<!-- BEGIN {BLOCK_ID} -->
  <td><img src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
  <td><img src="themes/rainy_day/images/button1_r1_c1.gif" width="5" height="25" border="0" alt="" /></td>
  <td style="background-image:url(themes/rainy_day/images/button1_r1_c2.gif)">
          <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a>
  </td>
  <td><img src="themes/rainy_day/images/button1_r1_c3.gif" width="5" height="25" border="0" alt="" /></td>
<!-- END {BLOCK_ID} -->
EOT;

// HTML template for sub menu

$template_sub_menu = <<<EOT

                       <div class="topmenu"><table border="0" cellpadding="0" cellspacing="0">
                                <tr>
<!-- BEGIN custom_link -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="{CUSTOM_LNK_TGT}" title="{CUSTOM_LNK_TITLE}">{CUSTOM_LNK_LNK}</a>
                                        </td>
                              <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
                              <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                          <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="http://www.ntsshow.com" title="{FAV_LNK}">{FAV_LNK}</a>
                                        </td>
                              <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
                              <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                              <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="{SEARCH_TGT}" title="{SEARCH_LNK}">{SEARCH_LNK}</a>
                                        </td>
                                       
                                        <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
<!-- END custom_link -->
<!-- BEGIN album_list -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
<!-- END album_list -->
                                                            
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                       <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="{LASTUP_TGT}" title="{LASTUP_LNK}">{LASTUP_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                       <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="{LASTCOM_TGT}" title="{LASTCOM_LNK}">{LASTCOM_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="{TOPN_TGT}" title="{TOPN_LNK}">{TOPN_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft1" src="themes/rainy_day/images/button1_r1_c1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/rainy_day/images/button1_r1_c2.gif);">
                                                <a href="{TOPRATED_TGT}" title="{TOPRATED_LNK}">{TOPRATED_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/rainy_day/images/button1_r1_c3.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                     
                                       
                                       
                                </tr>
                        </table></div>

EOT;

?>
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on June 15, 2007, 07:22:09 pm
Please read the instructions, they tell you what to do.

Quote
if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: vinubhai on June 15, 2007, 08:24:27 pm
@nibbler...thanx 4 ur oding and help....

i followed the steps u provided in post1 ...and i got some error whn i pasted the youtube link...ie upload unsuccessful..
and then i used ur upload file and got the error   

Quote
faultCode0faultStringFatal error:Call to undefined function curl_init() in /home/vol1/phpnet.us/v/vinubhai/www/gallery/upload.php on line 73

thatz curl error...and suggestion...


http://swargam.coz.in/gallery/
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on June 15, 2007, 08:27:58 pm
If you have url_fopen enabled then use the original mod.
If you have curl support then use the posted file.
If you have neither you can't use the mod.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: vinubhai on June 16, 2007, 08:06:02 am
@nibbler...finally youtube is workin fine..thanx....i had 2 move 2 a new host...

but nw i m able 2 play a video whch i uploaded...and not others...

Quote
// 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';
   }

wat shud be the xxxx value here....

thanx in advance
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: vinubhai on June 16, 2007, 08:11:32 am
sorry ..the other video was corrupt 1.... ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: andyleery on June 16, 2007, 01:19:25 pm
Hi I have a problem with installing this mod.

Quote
theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)

What dou you mean with that? I have got the theme "ipodlounge".
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: andyleery on June 16, 2007, 01:29:05 pm
Cant you edit own posts here?
I have now unterstand how I have to do the theme modifications but why is there no Videotitle displayed?
http://www.bollybilder.de/displayimage.php?album=lastup&cat=0&pos=0

In the title there is only this "youtube 9DFCUAjH0G8", which is also not nice named *g*
THX 4 helping.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: andyleery on June 16, 2007, 01:41:27 pm
Ok I even could fix this problem, so just delete my posts, I'm sorry, see u next time :-)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: TURRON on July 12, 2007, 07:52:42 am
I weigh enough time treating to install and it is not to me, in which estare failing? if they can help me (they excuse the English, I speak Spanish)


http://img297.imageshack.us/img297/3177/coppermineyoutubeerrorhs2.jpg

http://img484.imageshack.us/img484/2775/dibujonl9.jpg

   
this says in theme.php

Code: [Select]
<?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);

?>


THNK
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 12, 2007, 09:09:33 pm
Follow the instructions. You need to add the code I posted into your theme.php so that the video will be displayed. To add videos - 'Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx'
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: TURRON on July 13, 2007, 01:14:01 am
I even follow without understanding, which I publish is theme.php but as I leave it? that is my great doubt, of the form that modifies theme is with errors. AS IT MUST BE LEFT THEME.PHP?


   
I have leido everything but profit without understanding, really I feel it: (
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: TURRON on July 16, 2007, 08:20:24 am
excuse that it writes again but for my this is very important, if somebody were amiable and could stick a configuration of his theme.php and his upload.php I thank for much PS: excuse my English, is bad

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: thapame on July 20, 2007, 04:16:38 pm
I have installed this mod and working fine. But some times the youtube videos will be removed from the youtube site so in that case I need to replace it with another video. how can I do this?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Pascal YAP on July 20, 2007, 10:53:30 pm
I,

2 solutions :
1/ Delete this old video !
2/ Try to use PhpMyAdmin and change the video name and ID...

PYAP
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: thapame on July 20, 2007, 11:01:13 pm
as the youtube video is not hosted with my hosting so i think it's better to edit from the phpmyadmin.
anyone please let me know if there is any mod or releasing on future

thx
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: cong on July 21, 2007, 06:20:57 am

First i want to thank you Mr.Nibbler  you are great   :-*

I installed your mod and it is work perfect 

And i have a question. >>> how can description and title and keywords taken automatically from you tube site ?? ??

Another question . >>> are this legal to run you tube videos on my site ( outside you tube site ) ?? ??

Thank you in advance
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 21, 2007, 06:02:07 pm
It uses their own API and is perfectly legal.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: gnp on July 31, 2007, 08:50:30 pm
Everything seems to be working accept I too am only getting the images thumb and not the video. I have read over all 7 pages and made needed changes to upload and theme files.
I am however using coppermine bridged with e107 cms if that may be part of the problem. I do have php 5.2.2 and url_fopen enabled.
I have uploaded my theme and upload files to this post and you can view a yt video at this link http://mmaworldwidemagazine.net/gallery/displayimage.php?album=12&pos=0
Any and all help is greatly appreciated and Thanks! in advance.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 31, 2007, 09:04:52 pm
I don't provide support for people who don't have the 'powered by coppermine' footer.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: gnp on July 31, 2007, 11:34:29 pm
Hmmm, any idea how to ad it? I see it on a couple other coppermine sites (including my other website) but dont see an option in admin settings to add it. I have no problem supporting the makers of coppermine. I use it on my other site (and it shows up on it) http://www.groundnpound.org/gallery/ but it is an earlier version then the one Im using on this site.
I have not removed it myself but am more than happy to add it in there somehow, just dont know how.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: gnp on August 01, 2007, 12:10:27 am
I reuploaded the files but this time got them from coppermine instead of using the files that I got with the bridge and while I do have coppermine powered by in the footer I dont know what file caused it not to show up and I still have the problem with it only showing the video thumbnail and not the video playing.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: isloera on August 01, 2007, 07:35:50 am
I have exactly the same problem here! Plz help me to fix this problem.

I had the same problem when I installed this mod, but I found the fix and here it is ;)

The problem exist with the following instruction:

MAke sure you find  this code at around line #916 in the upload.php file
Code: [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)
        );

Then replace with:
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)
        );

}

I had exactly the same problem as you did and it was because I was finding and replacing the code really fast and I did't pay attention on this step and I ended up replacing the following section of code instead of the correct one.

This code is found at around line # 2526 : make sure you don't change this code
Code: [Select]
$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),

    );

As you can see it looks a little similar and by changing this wrong section of code you can get the same problem that you have.

I hope this helps ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: gnp on August 02, 2007, 12:47:30 am
Thanks Nibbler! Great plugin that I now have working :)
Note to self and others to follow, sometimes its a good idea to read through twice, just to make sure there is something you didnt miss (like I did)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on August 02, 2007, 09:28:01 am
Thank you for the review. Just a clarification though: this is a mod, not a plugin. A plugin uses per difinition the plugin API of Coppermine and doesn't need edits of core code. The youtube mod by Nibbler doesn't use the plugin API. Hacking the code is mandatory if you want to use it.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: just_some_guy on August 11, 2007, 06:30:54 pm
Sorry for being dumb, i use the classic theme and when i come to the last step i get confused. theme.php dosent have that coding. and i dont under stand the other option, can you explain please.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: gnp on August 11, 2007, 06:38:55 pm
In the theme.php of the theme named sample is where you find the code you need to add to your theme but dont make the mistake I did. After you add the code to your theme.php be sure to make the modification explained in the first post. Another member posted the code on page 2 of this thread http://forum.coppermine-gallery.net/index.php?topic=37962.msg181126#msg181126
BUT! Again even using that code you need to apply the mod explained in the very first post of this thread.
Good luck!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: just_some_guy on August 11, 2007, 06:40:43 pm
ok thankyou, i will do that after i have a solution to the prob with the moderator.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: just_some_guy on August 11, 2007, 11:22:49 pm
ok...so i open up theme.php (classic theme) and paste this code: (GauGau posted this earlier ( the one from the link):
Code: [Select]
// 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&amp;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);
}

Then i do the last step of the tutorial and the finished theme.php code would look like this?

code:

Code: [Select]
// 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&amp;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);
}


Correct? sorry i am being a bit over cautious. Last time i attepted this mod i had big problems getting it to work again.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: pelhrimak on August 24, 2007, 10:42:44 am
I have make mini tool.

If you want to download youtube video, use my upgrade.

theme.php find
Code: [Select]
</embed></object><br />';
replace it
Quote
</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>';

DEMO:

http://videoklipy.zabava-portal.eu/displayimage.php?album=38&pos=0#nav_pic
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on August 24, 2007, 02:51:58 pm
[youtube.com] Error: Not a valid URL (http://youtube.com/watch?v=g50vzZzAja0). Visit our web to know in detail what video sites are supported.

Nice.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: pelhrimak on August 24, 2007, 04:58:11 pm
Tomorrow it worked, I think, that their server is busy.

:)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on August 24, 2007, 06:40:09 pm
[sarcasm]
Sure. Youtube must be to blame, they are known to have weak servers and to change their API constantly. It's impossible that there is someting wrong with your code.
[/sarcasm]

 ::)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: pelhrimak on August 25, 2007, 09:51:39 am
#2 :)

If you want to download youtube video, use my upgrade.

theme.php find
Code: [Select]
</embed></object><br />';
replace it
Code: [Select]
</embed></object><br /><a href="http://cache.googlevideo.com/get_video?video_id='. $vid . '">Download it!</a>
DEMO:

http://videoklipy.zabava-portal.eu/displayimage.php?album=38&pos=0#nav_pic
[/quote]
Title: Uploading Youtube Videos
Post by: bpw on September 07, 2007, 01:24:53 am
i'm making a video section for my site and i want to add youtube videos eveytime i try to upload a youtube video i get

0 uploads were successful.

i already read and did everything from: http://forum.coppermine-gallery.net/index.php?topic=37962.0
and i'm still not getting it

the url to my site is http://bradpittweb.com/video/
Title: Re: Uploading Youtube Videos
Post by: Nibbler on September 07, 2007, 01:30:22 am
It would help if you provide a way for us to test it...
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on September 10, 2007, 11:33:02 pm
Nibbler,

The demo site you list on your thread opener is no longer valid. Do you have an alternative you could change it to?

I would like to do this mod but would like to see it working first
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on September 11, 2007, 01:07:36 am
Link updated, but you'd be better off reviewing links posted in this thread by others to see the original mod.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on September 11, 2007, 09:15:29 pm
Thanks Nibbler. That theme you use in that site is fantastic by the way, you really are quite good at this stuff.

I integrated this mod just now and it works really well (once I installed it to the right coppermine install while viewing another :-[)

http://www.windsurf.me.uk/cpg133/thumbnails.php?album=34 (http://www.windsurf.me.uk/cpg133/thumbnails.php?album=34)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ff on September 30, 2007, 05:18:57 pm
Sometime you don't want any related video's to be shown after your movie has finished.

Edit theme.php and find this line:

Quote

$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 />';

Replace with:

Quote

$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 />';

The addition is &rel=0 after the movie-ID.
This comes from YouTube, so you can use it without fear ;)

PS. GREAT MOD
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: alanpalan on September 30, 2007, 09:50:54 pm
hi. i want to use this great looking mod to my coppermine gallery. but i must tu ask one stupid question - what exactly is Youtube API ID and how can i get it? i created Youtube developer account... but what next? how can i get the desired ID? :) thank you for answer :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on September 30, 2007, 11:13:41 pm
An API ID is a system many vendors use to keep a check on the usage and control the use of their APIs. With youtube you can see your code by clicking on the link below when you are logged on as a developer.

http://www.youtube.com/my_profile_dev (http://www.youtube.com/my_profile_dev)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: alanpalan on October 06, 2007, 08:00:31 pm
is it possible to send ecard (or mail to your friend) with specific youtube video in coppermine gallery?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on October 07, 2007, 10:02:31 am
No.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: dreams83 on October 26, 2007, 10:10:00 am
A little something I made to pull series and such from youtube. it allow you to search and uplaod from youtube to your server by specifying title, author and such from youtube.

See Picture below

make a "youtube_search.php" file in the root of coppermine with the code below


Code: [Select]
<?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();
?>


maybe someone can help me check:

Code: [Select]
preg_match_all('/http:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_\+\-\.]{11})/', $xdata, $matches);
to see if it is correct. not good with regular expressions. I just want to get all the "http://www.youtube.com/watch?v=xxxxxxxxxxx" links. But I am not good at it so I got that to work but maybe someone can fix it to make it better.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: elvisq on October 30, 2007, 04:35:25 pm
http://forum.coppermine-gallery.net/index.php?topic=37962.0 (http://forum.coppermine-gallery.net/index.php?topic=37962.0)

non c'è una guida in italiano???


grazie

o qualcuno che abbia voglia di spiegarlo passo passo...

grazie

elvis
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on October 30, 2007, 07:10:35 pm
In this thread (and all other boards outside of the language-specific support boards (http://forum.coppermine-gallery.net/index.php?board=37.0)) only English is permitted. If you don't speak English, post your question on the Italian sub-board (http://forum.coppermine-gallery.net/index.php?board=89.0), with a reference to this thread. Maybe Lontano (the moderator of the Italian support board) will be able to help you.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: holyworld on November 12, 2007, 12:14:28 am
Great MOD, but a quick question: Is it not possible to create a Plugin for this instead of a MOD.. as with each upgrade the files needs to be updated.

Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 12, 2007, 12:50:27 am
No. It's only one core file anyway.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: skmdd on November 12, 2007, 06:25:19 am
I am getting the following error when I upload a youtube video after applying the mods.

YT errors:
URI   Error message
1. http://youtube.com/watch?v=EIlzEloTQxM

What can be the possible error.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 12, 2007, 09:16:59 am
Do URI uploads work?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: skmdd on November 12, 2007, 07:56:00 pm
The URI is not working either.
What could be the possible problem?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: skmdd on November 12, 2007, 08:07:01 pm
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
Code: [Select]
define('THEME_IS_XHTML10_TRANSITIONAL',1); and works fine now.

Thanks :)


I also broke my sitemap after this mod. Could you elaborate how you fixed yours.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on November 13, 2007, 07:37:28 am
If URI uploads don't work then you can't use this mod - your webhost probably disabled url_fopen.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: holyworld on November 16, 2007, 09:29:20 pm
Just FYI, according to my webshoster, url_fopen can be enabled by setting it in a PHP.ini file which has to be copied to the root directory.

cheers
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: holyworld on November 16, 2007, 09:50:37 pm
Just tried it out and it worked.

php.ini

content:

allow_url_fopen = On

put it in Coppermine root directory..

thats it!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 16, 2007, 09:53:36 pm
For anyone who can't change their php config like that, there is code posted a few pages back that uses cURL instead which may work.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: skmdd on November 20, 2007, 06:25:20 pm
Thanks all of you. I have successfully made the changes to display the youtube videos:
http://decoratingdesktop.com/index.php?cat=17 (http://decoratingdesktop.com/index.php?cat=17)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jesusarmy on November 23, 2007, 01:22:52 pm
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.

In Stramm's modded version of picmgmt.inc, find:
Code: [Select]
function resize_image($src_file, $dest_file, $new_size, $method, $thumb_use, $watermark="false", $sharpen=0, $media_type="false", $quality="false")
{
after it insert:
Code: [Select]
// 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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jesusarmy on November 23, 2007, 01:37:01 pm
Just to add to my previous post, that you may well find that you have to update your browser cache before you see the new watermarked thumbnails if you recreate them through Admin Tools | Update thumbs.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on November 23, 2007, 07:23:11 pm
Nice to see you are putting the effort in but what is the point of overlaying a watermark over embedded youtube video?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jesusarmy on November 23, 2007, 07:58:44 pm
The thumbnail now shows "video" as an overlay, so that users know that the link is to a video. This is particularly helpful when the YouTube link appears in another thematic album if the keyword of the album is included in the video's keywords.

So, for example, I have an album containing pictures of our Coventry Jesus Centre. I also have an album of YouTube videos. One of those features the Coventry Jesus Centre, and its keywords cause it to also appear among the Coventry Jesus Centre pictures. See http://www.jesus.org.uk/gallery/thumbnails.php?album=1 (http://www.jesus.org.uk/gallery/thumbnails.php?album=1). With the watermark, it is clear what to expect.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: santoro on November 25, 2007, 01:09:45 am
I do every steps described here, but i have this error message message:

Error Report
The following uploads encountered errors:
YT errors:
URI Error message
1. http://www.youtube.com/watch?v=wqZiYKIjH7I

What does it mean and what can I do with it? Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 25, 2007, 01:17:04 am
See http://forum.coppermine-gallery.net/index.php?topic=37962.msg230750#msg230750
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: santoro on November 25, 2007, 02:07:01 am
Thanks. I used your "modded version of upload.php that allows you to use the mod on servers without URL fopen support" from your message posted on January 03, 2007.
It works, but I want to ask if it's ok to use this version upload.php for the latest version of Coppermine?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 25, 2007, 03:34:08 pm
Generally speaking no, but in this case it's OK since the file has not changed since then.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: disposition on December 07, 2007, 12:36:08 am
I don't see fopen in my PHP.INI so should I assume I do not have access or is it somewhere else?

Just asking.

Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on December 07, 2007, 09:15:25 am
Search php.ini for "allow_url_fopen". Refer to http://www.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen for details.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on December 12, 2007, 08:52:03 pm
Since upgrading to the latest coppermine release i'm getting the following error on uploading a video.

Fatal error: Call to undefined function: file_put_contents() in /data/members/paid/w/i/windsurf.me.uk/htdocs/www/cpg133/upload.php on line 2003

I've tried re doing the mod to a fresh download of upload.php but no joy.

Any ideas?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 12, 2007, 08:54:16 pm
Read the mod more carefully, paying extra special attention to the first block of code.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: darkpollo on December 14, 2007, 10:40:21 am
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

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on December 14, 2007, 04:51:54 pm
Cheers Nibbler,

It seems my host was playing silly beggers again. I did have php5 but when they did their recent server upgrade they didn't properly install it.

Thanks for the tip, I wouldn't have discovered the problem otherwise.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: racerfreak85 on December 21, 2007, 07:04:54 pm
I have install the mod , but , I upload an video , But I get only the jpg and not the video



i have the same problem.
i read everything several times but i always see only a picture and not the video ??? :(

can you please check my files. i think the mistake is in theme.php but here is also my upload file anyway...

i really would like to use this great mod!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 21, 2007, 07:07:40 pm
This mod is for Coppermine 1.4 only.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: racerfreak85 on December 22, 2007, 08:19:08 pm
ok now it works perfectly!!

THANKS!!!!!! ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: qubbah on December 27, 2007, 10:39:33 pm
Very very nice code....

But one more problem is i cannot make it running with Yuotube...

furlopen problem...

how can i make it with htaccess....?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on December 28, 2007, 10:42:24 am
Not at all. You can not configure PHP settings using .htaccess, since .htaccess is a Lunix file that can have an impact on Apache only. The file to edit would be php.ini. However, you need to be in charge of the webserver (i.e. be the webserver admin) to be able to edit that file. If you're webhosted, you can't change that. Your webhost has deliberately disabled url_fopen for security reasons - they probably haven't left a backdoor for you to re-enable it. This being said: there is nothing you can do to circumvent this (i.e. to get this mod working) except switching webhosts and signing up with a webhost that allows url_fopen.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: nish on January 12, 2008, 06:23:29 pm
hi nibbler,
        your mod is awesome. i feel if you can put both upload.php and theme.php here then people can replace those files. with there files. and wont make small mistakes. i am also thinking of trying this but have no idea how to get youtube api id.

can u help i visted the link mentioned by you. but still have no idea how to get api id.
what setting needs to be done in php.ini to give fopen permission.

Thanks
Nish
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on January 12, 2008, 06:51:53 pm
It would not be worth adding theme.php and upload.php here for the following reasons.

Theme.php - Most people do not use the same theme therefore all have a different theme.php. With hundreds of different themes out there and many customised, what would be the point. It's only a small modification anyway.

Update.php - This changes whenever a new version of coppermine came out. If Nibbler had to keep every mod he ever makes updated he would spend half his life doing it.

Doing the mod is quite simple. If you do make a mistake you learn a lot. Being spoon fed you learn nothing.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: nish on January 14, 2008, 05:32:24 am
i agree with u.
         i tried the hack myself. but getting error on line 210

      $listArray[$list_count]['cat'] = $lang_upload_php['personal_albums'];

as it seems that there is no error in theis line.

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/nishant/public_html/video/upload.php on line 210

i am attaching the upload.php please have a review at it and help in solving the issue.
url http://www.lakesparadise.com/video/upload.php

i tried searching google for developer id. but cant find anyware. i searched also the youtube devloper api. but have no idea from where i can get the dev id plz hell.

thanks
nish
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on January 14, 2008, 08:34:20 am
That error is nowhere near any code you need to modify. Follow the instructions carefully. You get the dev id at the link provided, looks like they have a new API at google now, so the one you want is the older legacy/deprecated one.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: uzidesign on January 23, 2008, 07:53:09 pm
This is great mod, thanks!
I have one question, how can i make this mod enable for all users?
When i upload video from youtube it is upload ok,
But when user upload video hi get error:
Code: [Select]

URI Error message
 8Bad, unknown, or disabled dev_id specified

Regards,
uzi.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on January 24, 2008, 10:35:43 am
It works exactly the same for admins and users.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: uzidesign on January 24, 2008, 12:43:20 pm
So why the user get this error?
And when i make test with user account in the first time upload i get this error,
but in the second time when i upload the same video it is upload without problem.

Any idea?  thanks.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: olti on January 25, 2008, 01:24:31 pm
This mod was working like a charm for me, but since a few days not anymore. I haven't changed anything.

I just get this when try to upload a youtube video.

Quote

YT errors:
URI   Error message
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: xDazedx on February 06, 2008, 11:11:08 pm
hey I was wondering, how long did it take to get your youtube dev id? I went to my account and added the info and clicked submit and it just disappears lol. I am hoping the info got sent.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: xDazedx on February 07, 2008, 01:50:07 am
ok have a question here.

my host does not allow - allow_fopen_url. so in this thread I found the other upload.php file that uses curl. When trying to do a simple upload of an image using http://www.link.com/pix.jpg I get an error of - HTTP/1.1 200 OK.  I am using v1.4.16. Anyone know a fix to this or do I need to move to a new host?

Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: afrohead on February 19, 2008, 04:49:01 am
Do you still need the Developer API ID for YouTube development?

http://code.google.com/support/bin/answer.py?answer=74718&topic=12358
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 19, 2008, 11:50:07 am
For the legacy API, yes.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: afrohead on February 19, 2008, 10:06:40 pm
Evidently you can't get an API ID anymore, or at least there isn't any way of applying for one from the YouTube API pages I have visited.  If I understand what you are saying if we want to use this mod we need a developer API ID?  That is a real bummer as it appears you no longer can get an API ID for YouTube.  Looks like a fun mod though.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: afrohead on February 19, 2008, 11:51:42 pm
Yes, you still can get a developer api id from YouTube.  I had to Google it to find the right information to get a developer id as they don't have any good information on the YouTube/dev site.  How ironic.  You have to have a YouTube account of course, then you can visit this page to get your ID: http://www.youtube.com/my_profile_dev

Hope that helps.  Thanks
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: afrohead on February 20, 2008, 04:48:40 am
This mod works great with CPMfetch and the ITunes Flash Slideshow by RPHMedia.  Nibbler you wrote one nice mod here and I just want to say thanks.  Both the CPMFetch and ITunes slideshow mods pick up the thumbnail image off of the gallery photos.  This mod creates thumbnails for each YouTube video and they display perfectly in the aforementioned syndication mods.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeffnow on February 21, 2008, 01:16:44 am
Hello, I got the mod installed, youtube work great, but now my movie files (wma) no longer play. Please, tell me why? Thanks
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 21, 2008, 01:58:36 am
Post a link.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Keanu on February 21, 2008, 02:58:01 am
Okay ya'll going to hate me for this one... Can you help me out with my code? :D...

I'm so close to finishing it, I just need to do "theme.php"...

Code: [Select]
<?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;


?>


Okay, as you may be able to see..? There is no;

Code: [Select]
if (isset($image_size['reduced'])) {
So I have no way to add the other part on.. Now I was reading around that.. Well - From the impression given, that you could just over-write the old theme.php with a theme.php that actually has the previously coded in it.

But, when I tried that.. It phailed badly... Now all thats showing on my site is:

Code: [Select]
// 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'],

You understand my dilema?

then when i change it back I get:

Code: [Select]
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>

Code: [Select]
http://aro-network.co.uk/ths/HG/ <-- Site link..

If anyone would be so kind as to edit the theme.php I'm adding onto this as an attachment.. I'd love them forever.

Thanks in advance!
-Keanu
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Keanu on February 21, 2008, 02:59:28 am
So sorry for double posting, I don't understand why we can't just edit our posts.. /swt..

Its not attached - Its the first set of [code ] [/code ] 's
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 21, 2008, 03:29:04 am
When you copy the function you need to put it before the ?> at the end of the file. Alternatively just leave out the ?> altogether.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Keanu on February 21, 2008, 03:34:04 am
Okay done, and its all working!

Thanks!

Quick question, can I make like.. another
Code: [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);

And change it to;

Code: [Select]
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);
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 21, 2008, 09:45:43 am
Only if they have exactly the same API as youtube.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Keanu on February 21, 2008, 02:50:33 pm
If not, then will it not work?.. Is it possible to code a new one?.. I mean - Yeah, they have a API.. But from what I saw, it was.. Pretty damn different. xD

Thanks in advance!
-Keanu
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 21, 2008, 03:15:06 pm
Possible if you know PHP.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Keanu on February 21, 2008, 10:27:39 pm
Okay, thanks for vauge answers. ^^

-Keanu
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeffnow on February 22, 2008, 06:21:04 am
Hello,

OK, I got the youtube links and my movie files to work. Thanks for the link: http://forum.coppermine-gallery.net/index.php?topic=31291.msg167000#msg167000  to help me with my movies playing problem.

Now, I have another problem trying to upload pictures/ photo. I clicked at upload and the upload page load up. I then clicked on the browse and selected the picture, just one file for now. I then clicked at contiue. It stated 1 file uploaded complete. Then I need to to select the folder to put the file that I just uploaded. It then came back to the upload page. Nothing show up at the " last additions" or the new folder that i've just created.

Please, help.

Thanks again
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: skmdd on March 03, 2008, 05:32:23 am
I had uploaded few youtube videos on my site using this mod. Youtube had disabled embedding of one of the videos which is under most viewed videos on my site. On searching youtube, I found another similar video.
Can I change the youtube video ID v=xxxxxx at the backend so that the video on my site points to this new youtube video URI?
I had a look at "cpg1411_gallerypictures" table. I could find a column with "youtube_LNVOl5_3_Zo.jpg". Would changing the video ID on this column point to the new Video URI?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 03, 2008, 09:08:55 am
Yeah. You'd need to fix the thumbnail too though.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: skmdd on March 03, 2008, 02:10:44 pm
Thanks. Fixed it. I had to change youtube_xxxx.jpg file as well as thumb_youtube_xxxx.jpg file.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Elwood J. Blues on March 08, 2008, 09:56:29 pm
Hello !

I have a BIG problem, I need this mod and my web host has disabled the fopen function... And this mod doesn't work... I don't know if a solution exist yet but I propose my solution. I use cURL function instead of fopen function.

Search
Code: [Select]
$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);

Replace with :

Code: [Select]
$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);

Enjoy !

PS : In French http://forum.coppermine-gallery.net/index.php/topic,37970.msg246410.html#msg246410
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 08, 2008, 10:29:28 pm
I already posted a version that uses cURL in this thread.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Elwood J. Blues on March 08, 2008, 10:32:33 pm
Sorry...

Can you insert a link in the first post for other user ?

Thanks
Title: help you tube in copermine
Post by: angeles on March 12, 2008, 06:18:25 pm
I did everything they said article to introduce youtube in coppermine, the principle seems to work but when I reach the final or December "The file could not be placed above."
Help please be any nonsense
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Radyan on March 22, 2008, 09:32:06 pm
Thank You very much, it looks great!!!!  :D
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Kimosabe on March 25, 2008, 06:23:59 pm
Hello, i am new Coppermine user (great app!)
I was trying to install the Youtube mod, and as you have already guessed, something went wrong.


Nibbler, few posts earlier you mentioned a cURL version of the hack, but i couldn't spot it.
Could you please tell me where it is?


Thank you in advance and sorry for asking something that is potentially obvious
for more advanced users than me.



Additional info:

-I am using phpbb2 v2.0.23 bridged with Coppermine v1.4.16
-My hosting company is unable to enable the furl function, so uri uploads don't work
-I am using the original theme
-I also included in your original hacks the steps described by
Joachim Müller here
http://forum.coppermine-gallery.net/index.php/topic,37962.msg181126.html#msg181126

and Elwood J. Blues here
http://forum.coppermine-gallery.net/index.php/topic,37962.msg246409.html#msg246409

-The error i get is the following:
YT errors:
URI   Error message
1. http://www.youtube.com/watch?v=6aYu0YapSm0   8Bad, unknown, or disabled dev_id specified.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on March 25, 2008, 08:26:14 pm
Have you input your dev id correctly?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Kimosabe on March 25, 2008, 09:18:32 pm
I did. I checked, i double checked, but i will check it again  :)

Yes, i suppose i did. Just to be sure, is the dev id the 100digit id?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 25, 2008, 11:17:14 pm
That doesn't make any sense. The message you see is from the youtube API which means either allow_url_fopen is enabled or you are using the cURL version already. I'm pretty sure the devid is not that long - make sure you have the correct one.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 25, 2008, 11:22:18 pm
Mine is like this: XXxx9xX9x99
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Kimosabe on March 28, 2008, 11:12:53 am
You were right, thank you! I feel so stupid right now...  :-[
I have searched this board and google for at least 4hours, but i haven't thought of the obvious. Check my dev_id!


For those who might have doubts about their Youtube developer id

The dev_id can be obtained at: http://www.youtube.com/my_profile_dev
The dev_id's form is: XXxxxxXXxXX (like mentioned by Nibbler's post above)

Thanks again for the great mod!
Greetings from Greece!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeffamm on March 31, 2008, 01:05:58 pm
Thanks for posting this.  My installation went smoothly and the youtube upload boxes appear on the file upload page.  But after uploading a youtube video nothing happens when I click on a youtube thumbnail to play the file.  I'm guessing this has something to do with the fopen thing.  I loaded the php.ini file (initially it was labelled php.ini.default, so I changed it to be just php.ini) but my hosting company could not say for sure where this file should appear (which folder).  I didn't see anyone else with this problem in the thread.  I'm a complete newb to coppermine so maybe I've got something set wrong.  Can anyone suggest something to try?

To see what I mean by nothing happens, here is the link http://www.learnandreturn.com/index.php
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Kimosabe on March 31, 2008, 01:18:51 pm
Perhaps you could try what i did,
i followed Nibblers instructions (1st post)
and additionally i did what these posts say:

Joachim Müller here
http://forum.coppermine-gallery.net/index.php/topic,37962.msg181126.html#msg181126

and Elwood J. Blues here
http://forum.coppermine-gallery.net/index.php/topic,37962.msg246409.html#msg246409

i am using the curl, not the fopen function.
Hope it works for you as it worked for me!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on March 31, 2008, 01:30:46 pm
You didn't apply the changes to theme.php properly (or atall).
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeffamm on March 31, 2008, 02:59:29 pm
Thanks for responding, I've got it working.  Based on Nibbler's guidance to apply the changes to the theme (which I had already done) I realized that I must have changed the wrong theme.  I'm a self-admitted newb and didn't know which theme I'm using or even how to change themes yet, so I copied the changed theme file into all the theme folders in my installation.  I realize I've probably wrecked the ability to use any of the other themes in my installation, but I'll deal with that downstream when I'm ready to pick a new theme for real.  Thanks anyway Kimosabe, and thanks again Nibbler for making this mod available.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: misjka on April 01, 2008, 09:06:39 am
Seems to be a great mod, this one :)!

One question, though: I always get
Quote
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?

Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on April 01, 2008, 10:22:31 am
You need the dev id. This was already discussed just a few posts ago.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: misjka on April 01, 2008, 01:41:18 pm
You need the dev id. This was already discussed just a few posts ago.

OK, sorry for that one but this thread is kind of too messy to read in all its' total  :-\. Unfortunately I didn't make it less messy  ::)...

And besides, things would be more straight, I think, for ppl to use the proper words... To me the word "dev id" is a hybrid of Developer Key and Client ID, so that in itself got me puzzled...

But of course I'm much obliged for your reply, and I'll have yet another go for this one :)!

Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on April 01, 2008, 01:53:16 pm
Those terms didn't exist when I made this plugin - it's all changed to the Google API system now.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: misjka on April 02, 2008, 10:06:40 am
The dev_id can be obtained at: http://www.youtube.com/my_profile_dev
Thanks, 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)
Title: Video now says "We're sorry, this video is no longer available"
Post by: jeffamm on April 06, 2008, 06:16:12 pm
I'm using the youtube mod described in this thread and it is working fine.  However just now a couple of my videos display "We're sorry, this video is no longer available" in the youtube viewing box.  I checked the source video on youtube and the videos display fine there.  Has anyone else seen this happen or know how to fix?  I was experimenting with changing themes just before this happened, but don't know if this is cause and effect or coincidence.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on April 06, 2008, 09:40:55 pm
Post a link to an example.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeffamm on April 08, 2008, 01:36:20 am
OK, here's the link for one of the videos that now shows unavailable:

http://www.musictoots.com/displayimage.php?album=random&cat=0&pos=-3

Here's the link to youtube of the source video  http://www.youtube.com/watch?v=mHNvUkeREKM

thanks for any help
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on April 08, 2008, 01:38:11 am
That video has embedding disabled.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeffamm on April 08, 2008, 04:02:23 am
Thanks Nibbler, I didn't know videos could be blocked from embedding, and my search on that question through google didn't lead to an answer.  thanks again.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: kraftworkz on April 09, 2008, 08:55:10 pm
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



This is still an issue. Has anybody gotten this to work?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Paul-RDG on April 29, 2008, 01:23:08 pm
I have the same problem mensioned here before. I have installed the modification and also made the modifaction to my theme.php, still the video is only shown as a small jpeg. How can I fix this?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on April 29, 2008, 01:29:19 pm
Means you didn't edit your theme.php properly or you might have another plugin interfering.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Paul-RDG on April 29, 2008, 01:45:44 pm
I can't fint what's wrong:

Code: [Select]
<?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;">&laquo; <a href="{PREV_TGT}" title="{PREV_TITLE}">vorige</a> <b>|</b> <a href="{NEXT_TGT}" title="{NEXT_TITLE}">volgende</a> &raquo;</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}:&nbsp;&nbsp; </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" />&nbsp;
</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']) > 4array_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']==|| $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&amp;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);
}

?>
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on April 29, 2008, 01:48:45 pm
It's obvious - you didn't make the change atall. Read the instructions.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Paul-RDG on April 29, 2008, 01:57:41 pm
I showed the wrong theme.php, but I already find what I was doing wrong. Changed the wrong part of the code  ;D Stupid! Thanks anyway!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: orTubes on May 09, 2008, 01:41:16 am
 ???
You are showing an error:

The previous file could not be placed.

site = http:www.ortubes2.com
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: orTubes on May 09, 2008, 03:27:58 am
 ;D ;D ;D
This error was happening because of "Method for resizing images" was "Image Magic".

After the exchange worked perfectly ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: orTubes on May 09, 2008, 04:33:35 pm
I added the code in upload.php, and worked perfectly.

See http://www.ortubes.com (http://www.ortubes.com)

Code: [Select]
<?
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 message
Code: [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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on May 09, 2008, 04:35:33 pm
allow_url_include is a security risk. You don't need it.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: orTubes on May 15, 2008, 01:18:57 am
Users are coming to the area to add the album, then drop. Is there any way to make an album as standard?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on May 15, 2008, 10:04:54 am
That's not related to this mod.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Royal_VII on May 27, 2008, 10:18:22 pm
Hi Nibbler!

My name is Roy van Gom Neumann from Amsterdam, The Netherlands.
Thanks for your great work man, I really appreciate this beautifull mod!
I've got everything working except that I can't get all the themes to function properly.
The only theme that works fine is the classic theme.
I've just edited the upload.php and copied the entire theme.php file from the sample theme to the classic theme, and it works fine (with the classic theme!).
I did this because I din't know wich part of the code from the theme.php I schould copy
I know that I should edit the theme.php of the theme in question..
 
This is your instruction: "theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)"!

Actually I'm wondering wich part of the code from the sample.php I should copy, and where should I paste it?  ???
I would really appreciate it if you could answer my former question.
Thanks in advance.

Peace,  :)
Roy


Title: Re: Displaying videos from Youtube in Coppermine.
Post by: LeaX on June 10, 2008, 12:55:09 pm
Quote
upload.php, add this code near the top of the file after the comments
Please can you explain this phrase...
"after the comments" - what does it mean? After what phrase?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Royal_VII on June 10, 2008, 02:42:51 pm
The comments are the explanations before the scripting. When you use Notepad++ as your favorite text editor these symbols are (default) displayed in the color green! these symbols (or sentences) are no part of the actual programming and contains the signs //
I suggest you upgrade to PHP5 (if possible) so don't have to go through this!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: LeaX on June 11, 2008, 09:52:53 am
Thanks. Yeah I've just seen that I have PHP Version 5.2.6 ))

Ok... but I can't understand this too
Quote
if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change

What is "theme_html_picture"? And how can I "apply" it? To what apply?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on June 11, 2008, 06:44:59 pm
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  :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on June 11, 2008, 07:30:55 pm
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.

If you want people to help then try to do the basics for yourself and try and respect this boards policies.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mladja04 on June 11, 2008, 08:00:00 pm
Do I can to use this great mod with good version (some of last version) of PHP 4?


Do exist some youtube mod for us who have PHP 4?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: LeaX on June 11, 2008, 08:45:04 pm
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.
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(((
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on June 11, 2008, 09:45:13 pm
He's not talking to you. Pay attention to the use of quoting.

What is "theme_html_picture"? And how can I "apply" it? To what apply?

It's a function. You need to copy it from themes/sample/theme.php into your own theme.php and then make the code change described.

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  :)

This mod is coded for youtube, it is not designed to be a generic video mod.
It's easy to use, but add your own instructions. You can see where to do this fairly easily.
As with all mods to core code, you will need to reapply when you update. It can't easily be made into a plugin.

Do I can to use this great mod with good version (some of last version) of PHP 4?

Should work fine with PHP4. If it doesn't then post what the problem is.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on June 11, 2008, 10:09:33 pm
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(((

Appologies if it seems like it was directed at you, it was not. Also the post was not meant to come accross so grumpy ( I must be in a grumpy mood)

Attach your theme.php file (the one you are using for your theme) to your post and I will happilly copy accross the function you require. You will need to carry out the modification yourself (especially your youtube api key) but it will get you started.

Also be aware that there are forums in a number of languages on here where you might find it easier to ask your question.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: dr_drewww on June 12, 2008, 10:22:46 pm
Hi great mod everything works except the youtube title and description.
In the original post regarding this mod it says that the title and description
is added. I have gone nearly cross eyed going through the replys to find if some one else
has this issue.
can anyone tell me why the title and description from youtube is not being displayed. and how to fix it  ;D


thanks
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on June 12, 2008, 11:10:11 pm
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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: dr_drewww on June 13, 2008, 12:23:02 am
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.

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
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on June 13, 2008, 05:58:57 pm
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.

I must say how much I enjoyed reading the subsequent posts to my question...   :o phill104's arrogant and misdirected reply suggesting that I hadn't searched the 14 pages of threads on the subject or elsewhere in this SMF forum. and suggestion that my question(s) were on more than one subject. Wow, perhaps you need to be designated as CP Sheriff.

THANK YOU Nibbler for your direct and responsive reply!

It's too bad that someone hasn't coded a plugin or other video system for displaying videos from multipe providers such as the mods for SMF, TinyPortal, Joomla, etc. etc. that do that!

Clearly, the interest in this forum regarding YouTube alone suggests one is dearly needed.

And to you LeaX - Thank you for your understanding... Obviously you too have experienced frustrations in attempting to get answers to honest questions.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on June 13, 2008, 08:17:09 pm
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

Actually it doesn't automatically add the titles for me either. I have always added them myself manually with the description I wanted so I never realised that it should do anyway. You now have me scratching my head wondering why.

Do as Nibbler suggests and post a test account with upload rights, and debug mode with notices enabled so people on here can try and see what is going on.

I am also having problems viewing your site in IE but it is fine in Firefox and Safari.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on June 13, 2008, 09:20:12 pm
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
Integration issues aside, I just followed this link and clicked on three of the thumbnails.

Each crashed my browser..

Using IE 7 (screenshot attached)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jessemagano on June 19, 2008, 09:25:41 pm
How do I allow guest access to upload these youtube videos, right now only logged in users can upload youtube videos?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on June 19, 2008, 09:28:01 pm
http://forum.coppermine-gallery.net/index.php/topic,37962.msg193753.html#msg193753
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 26, 2008, 08:41:32 pm
Regarding this part of the YouTube changes, I need some clarification please...

theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)

Find

Code: [Select]
if (isset($image_size['reduced'])) {

Change to

Code: [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 am using the Valentine Theme, which apparently doesn't have that routine, so:
Quote
(if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)

I located this in the the sample theme (from the original distribution), however, I cannot figure out how much of the code to copy from this file, or where in the active template theme.php to place it.

I tried pasting the following (including the YouTube change above):

Code: [Select]
// 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&amp;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) ? '' : '&amp;cat=' . $cat;
        $uid_link = is_numeric($_GET['uid']) ? '&amp;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&amp;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&amp;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&amp;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&amp;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&amp;pid=$pid&amp;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&amp;pid=$pid&amp;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&amp;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&amp;pid=$pid&amp;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&amp;rate=0",
        '{RATE1}' => "ratepic.php?pic=$pid&amp;rate=1",
        '{RATE2}' => "ratepic.php?pic=$pid&amp;rate=2",
        '{RATE3}' => "ratepic.php?pic=$pid&amp;rate=3",
        '{RATE4}' => "ratepic.php?pic=$pid&amp;rate=4",
        '{RATE5}' => "ratepic.php?pic=$pid&amp;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);
}


and placed it just above
Code: [Select]
              //report to moderator buttons

I did this because this was where the next comment was...

but after testing, received a fatal error.

I reinstated the original theme.php (retaining the updated upload.php) and the fatal error goes away, so I know I've missed something in the theme file.

BTW, I have removed all theme files except the Valentine Theme. Is it advisable to have the default theme in place?

Have I copied too much?, too little?, placed it in the wrong place?

I am attaching theme.php as theme.txt for review if needed.

Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on July 26, 2008, 10:41:12 pm
I haven't tried it as I am currently on a work PC but try using the attached theme.php in your valentines theme.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 27, 2008, 04:33:22 am
I haven't tried it as I am currently on a work PC but try using the attached theme.php in your valentines theme.

Thanks Phill104, That seemed to work, and I can navigate to a video I uploaded via the album's "next file" button, and it plays OK...

However when I click on the file's thumbnail, it crashes the page in IE7...

It works in FF 3.0 with the following warning:
Quote
Warning: Expected ':' but found '='.  Declaration dropped.
Source File: http://womenmotorcyclist.com/community/cpg1418/displayimage.php?album=1&pos=4#top_display_media
Line: 0

Any ideas?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 29, 2008, 01:56:00 am
Since last post, I've added several YouTube Videos successfully, so I am fairly confident that the upload.php is working OK,
Once we work out the theme.php issues, I'll probably add a more definitave explanation for the user about the YouTube URL regarding not including any text following the video code IE: "&feature=related" etc.

However, IE7 (at least) doesn't like the theme.php changes, as it crashes 85% +.

Is this common? or is it possible there's something missing or incorrect in the file theme.php from Phill104's zip?

I'd sure like to resolve this IE issue.

Also Phill104, just for my own edification, I am curious about where I may have gone wrong in intepretring the instructions relative to the theme.php.

I was unable to understand the instruction:
Quote
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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2008, 11:08:18 am
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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 29, 2008, 06:01:57 pm
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.

Thanks Nibbler, I just feel embarrased but I'm still getting IE crashes...

I've followed the instructions for the theme mod.
I had originally added more code than that and got a php error, then I tried the file Phill104 provided which produced the crashes...

NOW
 ... here's what I added with the YouTube change (placed at end of file - before  "?>" )
Code: [Select]
// 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&amp;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

No Change... MOST of the time, Whenever I click on any video's thumbnail... IE7 crashes and I get a message "Internet Explorer cannot open the page 'url_here' Operation aborted.

Notes: I have YouTube and many other videos from outside provider videos playing on my site... Coppermine is bridged into Joomla 1.5.3... I have removed all other templates from the themes folder except the Valentines Theme.

Full theme.php attached as a txt file - Please advise!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: forced on July 29, 2008, 06:26:04 pm
Works great! Thanks!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2008, 06:33:59 pm
No idea sorry. I don't use windows. Only error I get with firefox is about loading http://www.halfmoonpub.co.uk/copper/halfmoon.css which does not exist. Try with the classic theme and no other modifications/javascript loaded.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 29, 2008, 07:00:49 pm
Nibbler...

Well now I know I've followed the instructions correctly...

I just clicked on a video at http://www.halfmoonpub.co.uk/copper/displayimage.php?album=lastup&cat=0&pos=2

and got the same crash!!!

I reloaded the page and the music vid played, then I reloaded (refreshed) again, and it crashed.

On your site, the page seemed to load (thumbnail showing) but just before it completes, the crash occurs.

I am happy to provide any additional information you'd like to resolve this.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2008, 07:36:43 pm
If it even crashes on my site then it's likely to be something wrong with your browser.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 29, 2008, 08:01:47 pm
Well it's not MY browser... I have tested this on four different computers (three testers). One even checked in IE6 - OMG!  :-[

ALL have the same problem with IE and none with FF.

I see there are references to IE in the script so obviously you've attempted to address the modification working with that browser.

I'd be quite happy to look at any browser settings if you think that might help.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on July 29, 2008, 11:47:34 pm
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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 30, 2008, 12:11:15 am
Thanks for sticking with this guys... I appreciate it.

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.

1) The only concern I have about this is that when I go to http://www.halfmoonpub.co.uk/copper/displayimage.php?album=lastup&cat=0&pos=2 I get the same IE7 error.
2) I asked two other people to test this and they have the same results in IE7 and IE6. Obviously that then points possibly to A. The bridge, B. Other plugins or C. PHP settings.

So,
A) which bridge are you using? I have Bridge by mehdiplugins.com
B) Any thoughts on other plugins that would affect YouTube in Coppermine?
C) Here's all my settings:
Problem Description:
Coppermine/YouTube Issues


Diagnostic Information
Joomla! Version: Joomla! 1.5.3 Production/Stable [ Vahi ] 22-April-2008 22:00 GMT
configuration.php: Writable (Mode: 644 ) | RG_EMULATION: N/A
Architecture/Platform: Linux 2.6.18-53.1.14.el5PAE ( i686) | Web Server: Apache ( womenmotorcyclist.com ) | PHP Version: 5.2.5
PHP Requirements: register_globals: Disabled | magic_quotes_gpc: Enabled | safe_mode: Disabled | MySQL Support: Yes | XML Support: Yes | zlib Support: Yes
mbstring Support (1.5): Yes | iconv Support (1.5): Yes | save.session_path: Writable | Max.Execution Time: 1200 seconds | File Uploads:  Enabled
MySQL Version: 5.0.45-community ( Localhost via UNIX socket )

Extended Information:
SEF: Disabled (with ReWrite)  | FTP Layer: Enabled | htaccess: Not Implemented
PHP/suExec: User and Web Server accounts are the same. (PHP/suExec probably installed)
PHP Environment: API: cgi | MySQLi: Yes | Max. Memory: 32M | Max. Upload Size: 75M | Max. Post Size: 75M | Max. Input Time: -1 | Zend Version: 2.2.0
Disabled Functions:
MySQL Client: 5.0.45 ( latin1 )


Phill104, May I have the links to the installations you've referred to so I can see how my browser reacts?

Thanks
            
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: phill104 on July 30, 2008, 08:58:44 am
http://www.windsurf.me.uk/cpg133/displayimage.php?album=34&pos=8

Bridged with Joomla using the same plugin.

I cannot post the valentines one I did as it was only a test and is now back to its required theme.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on July 30, 2008, 06:27:46 pm
Phill104, Yours (http://www.windsurf.me.uk/cpg133/displayimage.php?album=34&pos=8) plays OK...

However, http://www.halfmoonpub.co.uk/copper/displayimage.php?album=lastup&cat=0&pos=2

Crashes as do mine...

Are we using the same bridge?

Can you attach your upload.php? Maybe I missed something there...
If so, I assume all I'll need to change is the YouTube key - right?

Any other troubleshooting ideas?

Quote
Your theme doesn't display properly at all in IE
Can you be more specific? Do you mean Joomla Theme or Valentines?

I know there's some css issues where some screen resolutions push the maincolumn and right column down.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on August 01, 2008, 03:59:18 am
OK, I've done some experimenting to see if I could troubleshoot where the Internet Explorer problem lies.

Again, I am not the only one experiencing these crashes, so I know it's not my specific browser or its settings. And in as much as even Nibbler's video crashes in my IE.....  ???


:-\
I have to be honest... I don't exactly know what to conclude here...

Hopefully someone has some insight and can lead me to some sort of solution... I've found some very content specific YouTube Videos which would be a great asset in the gallery and encourage our members to participate even more in the gallery. I just cannot rule out the 33% +/- that use IE as their primary browser.

One thing it did learn for those using a bridge... When you unbridge, you loose all your "Group" permissions and have to reset them when you re-bridge!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tpr on August 05, 2008, 04:34:52 pm
Hi guys,
I did everything as instructed but my image/youtube uploads fail.

When i try to add an image (from a url) i get a message saying 0 files were uploaded with an error "File Name/URL"
When i try to add a video from youtube i just get the message saying 0 files were uploaded.

Please advise.

Guy N.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tpr on August 09, 2008, 05:19:12 pm
*ping*
anyone alive in here ?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on August 09, 2008, 05:24:31 pm
Post a link and test account if required.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tpr on August 09, 2008, 05:54:53 pm
hi,
thanks for the answer nibbler,
I reinstalled the mod and now i get the following error :
Error message
1. http://www.youtube.com/watch?v=q57dduRO4fc   8Bad, unknown, or disabled dev_id specified

now when i follow the link to the youtube api i ger redirected (they switched to a new api).
in the new location i can choose between :
Client ID
Developer Key

but both do not seem to work.
is there anything i need to change ?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on August 09, 2008, 06:45:30 pm
To update this mod for the new API, try the following:

find

Code: [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 to

Code: [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 find

Code: [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 to

Code: [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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tpr on August 09, 2008, 08:50:09 pm
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.

Thanks a lot mate,
saved my day ;)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: sranje on August 14, 2008, 05:46:02 am
New feature for this mod I found very recently an it's working:
Add fullsize video feature to embedded youtube videos.
I am still using the old version of the Nibblers youtube mod.

In you theme php

Find this line:

Code: [Select]
$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 />';
and replace with:

Code: [Select]
$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 />';
The similar change can also be used for Nibblers new youtube mod code.
(this also removes related videos from displaying related videos once the video is finished playing "rel=0")
Enjoy...
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bas123 on August 15, 2008, 03:37:03 am
And while we're at it...

If you want to modify the YouTube console with your site's template colors, you can add:
Code: [Select]
&color1=0xcc2550&color2=0xe87a9fWhere the colors conform to your Coppermine theme...

Mine are in the red/pink range...
So I modified the complete line as:
Code: [Select]
$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 />';
BTW, I apologize to Nibbler, Phill104, and any other interested party for not reporting sooner regarding the IE7 crashes that were discussed earlier...

At this point, where I was getting a crash maybe 90% of the time I opened a YT file for viewing... Now it happens maybe 5% which I can accept.

The solution was inadvertant on my part... I made a dramatic Joomla template reconfiguration regarding the position of the "right" module position, and the issue went away.

I believe there was a conflict between the whole coppermine bridge and how it was trying to push the right "div" or at least somehow conflicting for position. (I don't understand enough about this to know what exactly it was).

Anyway, Many other issues also went away that I had simply accepted including the admin config where the sections which expand and collapse were all opening up and couldn't collapse.

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: sarangan on September 02, 2008, 07:31:06 am
Hi,
I just have modified the very first hack that can be found at the following URL: http://forum.coppermine-gallery.net/index.php/topic,37962.msg178982.html#msg178982

Everythings works like you mentioned there, but the title and caption are not pulled from YouTube. :(
thumbnail have been uploaded succesfully.

I am using the latest version of Coppermine gallery.

Please help me to fix that problem.

Thank you.

I have attached the modified theme.php and upload.php
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: josvh88 on September 12, 2008, 02:30:38 pm
Hi all,
I tried to use this mod several times, but it never worked.
Maybe it didn't word due my youtube dev id, however I read that this ID isn't required anymore.
Is there someone on this forum who can post a working example of upload.php and theme.php without using the developer ID? I'm using the theme 'fruity' atm, don't know if it differs from the other themes..?

Thanks in advance,
Jos

PS: I'm sorry for my grammatical mistakes etc, me and the English language is like fire and water :').

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: himaloy on September 28, 2008, 05:21:52 am
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.

Hi Nibbler,

i have made these changes since the change you suggested in the first post didn't work for me coz od the new API..

i was able to get the thumbnail of the vedio but i'm recieving the following error:

Error message
1. http://www.youtube.com/watch?v=2EFMG_oQ5lE          Failed to find video


What am i doing wrong?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: zylys on October 04, 2008, 02:22:36 am
Hello,

I would like to know what do I need to modify to upload videos from Vimeo.com

Thanks in advance
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: fangweile on October 19, 2008, 05:14:43 am
Hello there,

How can I update the new youtube API using the curl version of this great mod?


Thanks a lot in advance.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: shaney on October 23, 2008, 04:07:01 pm
I am looking for the latest code to add youtube into coppermine, I can see there has been a lot of hard work getting this to work. I have looked throught the pages but i am a little confused as to what code to use as there have been updates/improvments to the original code. Could some nice person please post the latest code that needs to be changed here or point me in the right direction......Many thanks

I am using latest PHP
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on October 31, 2008, 03:49:44 pm
The word "latest" exists very often in your posting, but means absolutely nothing. What's "latest" for you? Read up board rules (http://forum.coppermine-gallery.net/index.php/topic,55415.0.html) as well.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Timos-Welt on November 05, 2008, 08:50:37 pm
This great mod will now (hopefully) work together with the latest beta version of EnlargeIt! - see here:
http://forum.coppermine-gallery.net/index.php/topic,53290.msg274490.html#msg274490

Version 2.12 of EnlargeIt! is still beta, so testers are very welcome. The support of this mod is the only change from version 2.11.

Demo (http://cpgdev.timos-welt.de/cpg1416/thumbnails.php?theme=water_drop&album=6)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tutt on November 06, 2008, 07:10:12 am
Hello,
I have made the code changes very carefully and I have a different issue than most other users.  Keep in mind that I have made some modifications to the bridge and other modifications to the theme, but I can't see how any would affect this youtube mod.

All I get when I try to upload a youtube video is a message saying "0 files uploaded sucessfully".  No other errors whatsoever.  url_fopen is on and regular photos can be uploaded by using URLs

I turned on debug mode and see this, but again, I doubt it is helpful:

/upload.php
Notice line 2086: Undefined variable: escrow_array
Notice line 2087: Undefined variable: file_failure_array
Notice line 2088: Undefined variable: URI_failure_array
Notice line 2089: Undefined variable: zip_failure_array
Notice line 2142: Undefined variable: YT_error_count

What are the possible problems that could cause just the 0 files uploaded sucessfully message without other errors?  TIA
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on November 06, 2008, 01:16:58 pm
You probably didn't edit upload.php correctly.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Timos-Welt on November 06, 2008, 06:40:41 pm
Hi Nibbler,

two proposals and a question, if you can find the time:

1)
Could you consolidate the first posting of this thread with this one (http://forum.coppermine-gallery.net/index.php/topic,37962.msg264919.html#msg264919)? It's impossible to use the old API for new people because you cannot get a dev API ID from YouTube at all anymore. The new version is in fact easier because no ID is needed. The current first posting is simply unusable.

2)
YouTube in the meantime uses 480x385px for their flash movie; I recommend to change this in the first posting as well.

3)
I'm surely no CPG expert, so a question: Do you think it would be possible to implement the changes you did to upload.php with a plugin? Would be interesting to include this in EnlargeIt!.

TIA!
Timo
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tutt on November 06, 2008, 07:30:03 pm
You probably didn't edit upload.php correctly.

I was quite careful in editting it.  I will go back and take another close look.  Do you or does coppermine offer any sort of paid support where I could have you login and try to get it working for me?  It is an important project I am working on.  Please let me know.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on November 06, 2008, 08:58:29 pm
There's a paid support board (http://forum.coppermine-gallery.net/index.php/board,30.0.html) where you can start a thread (please review the sticky thread there first), asking for freelancers to take the job. The coppermine staff (dev team members) usually don't perform jobs there, so there is not actual paid support by the coppermine dev team members.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jesusarmy on November 10, 2008, 02:37:02 pm
Is it possible with this mod to display YouTube Playlists, as for example http://uk.youtube.com/view_play_list?p=AF6146BA8E485501&playnext=1 ?

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: duerre on November 13, 2008, 08:49:36 pm
Hello!

This MOD is really great and working fine but I have a little problem.

I have a media gallery with both videos and pictures.

Now that I have install this MOD, intermediate image (normal_) won't display for the pictures.
On the http://mysite.com/coppermine/displayimage.php?album=lastup&cat=0&pos=0, I only have a full sized images but no normal_xxx.jpg file.
I checked on the admin panel, intermediate pictures are on and normal_xxx.jg files have been created and are on the server.

I think it may have something with the 'elseif (isset($image_size['reduced'])) {' code in theme.php but I don't know much about .php and can't understand what to do alone.

Thanks by advance.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: troy77 on November 15, 2008, 07:38:03 pm
Hi all, dont no what im doing wrong here but it keeps coming up with this error:

Error Report
The following uploads encountered errors: 
YT errors: 
URI Error message
1. http://uk.youtube.com/watch?v=JH5wEEFfer0
 
Can anyone help?
Yhanx
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Takako on December 02, 2008, 12:48:46 pm
Thankyou Nibbler for this very handy mod. I regret not installing this much earlier.

I'm not a programmer so there is nothing I can contribute code-wise, but I just merged your original instructions with the update on page 15, so as to ease any confusions when installing this.

Quote
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 find

Code: [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';
}
         
         
Find         

Code: [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.
     
Find

Code: [Select]
     
     $zip_error_count = count($zip_failure_array);

After, add

Code: [Select]
     
      $YT_error_count = count($YT_failure_array);
     
Find

Code: [Select]
   
        // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count) > 0) {
   
Change to

Code: [Select]
   
        // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count + $YT_error_count) > 0) {
     
Find

Code: [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>";

            }

        }
       
Find

Code: [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)

Find

Code: [Select]
if (isset($image_size['reduced'])) {

Change to

Code: [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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Takako on December 02, 2008, 02:36:44 pm
I've realised a problem with this mod, but I'm not sure if it's isolated to my theme. I've read through the thread, although it was mentioned by another user, he didn't follow it up and hence no solution was ever given.

I'm using the hardwired theme. This mod works like a charm displaying youtube hosted media, but after I applied the changes to theme.php, I can no longer play the windows media files hosted on my own site. I've tried the wmv/wma/asf ... all theses files that previously played doesn't work anymore. The rm files still played, so I think it's a problem with how the windows media player works after the youtube mod is installed. When I delete the changes to theme.php, then these files work again (youtube doesn't).

The hardwired theme doesn't orginally have the function theme_html_picture() part, so, as instructed I copied it from the sample theme. I'm not sure if I copied too much or too less.

I have attached my ammended theme.php as a text file here, would anyone be able to help me see whether there is any problems with this? And whether you can suggest any solutions?

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 02, 2008, 02:52:15 pm
There's a bug in the sample theme. In your theme.php find

Code: [Select]
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
change to

Code: [Select]
'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Takako on December 02, 2008, 04:04:38 pm
Thankyou very much for your prompt response Nibbler
Everything is working now~~

Cheers!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on December 03, 2008, 08:25:56 am
There's a bug in the sample theme. In your theme.php find

Code: [Select]
'clsid' => 'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
change to

Code: [Select]
'clsid' => 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ',
@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?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 03, 2008, 01:17:49 pm
Committed there too.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 09, 2008, 02:58:18 pm
I just can't seem to find where I can get Youtube Developer ID... I have a Google and Youtube Account and also both are connected. Or do I have to register somewhere else for a developer account?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 09, 2008, 03:04:58 pm
You don't need one. Read back a few pages.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 09, 2008, 03:14:36 pm
ah, found it! hvala  :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 09, 2008, 05:08:08 pm
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
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 10, 2008, 08:27:48 pm
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

no idea.... anyone? :( Or did I ask the wrong question?  :-X
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on December 10, 2008, 08:36:03 pm
I can't see anything wrong with the file. Make sure you edited the right theme, and that you actually uploaded it to your server. Maybe posting a link to your gallery would help.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 10, 2008, 08:40:16 pm
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
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 11, 2008, 05:37:21 pm
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


Could you find the problem or do you need any other info?  ???
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 12, 2008, 03:24:47 pm
Okay, shame on me for not being able to fix the problem on my own.... So I won't use this tool  :(
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hein Traag on December 12, 2008, 05:15:25 pm
Patience is a virtue, remember that all support is done by volunteers.

Besides that you need to upgrade first before expecting any support. At the moment you use <!--Coppermine Photo Gallery 1.4.18 (stable)-->
When 1.4.19 is the latest stable version.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Mimi123 on December 13, 2008, 05:46:10 pm
I'm sorry yaar, I just didn't have anymore time to wait. I didn't mean too sound rude.
But I actually uploaded CPG1419, I'm sure it wasn't 1418...

Anyway thanks for your help and your answers.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bajabum on December 24, 2008, 04:05:56 pm
spent tooooo many hours trying to install this mod.
I am looking to hire someone to do it for me.

webmaster@ensenada.com

thanks
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hein Traag on December 24, 2008, 04:16:29 pm
Then read through the sticky post on the Freelancers board and make a new post there.

Freelancers board sticky thread : http://forum.coppermine-gallery.net/index.php/board,30.0.html (http://forum.coppermine-gallery.net/index.php/board,30.0.html)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: cardshrk31 on January 27, 2009, 07:48:42 pm
I need some help. I have followed the install of this MOD and I get this error when I try to upload a youtube URL

YT ERROR
URI Error message
1. http://www.youtube.com/watch?v=o-Mo06wEQY8 6Unknown method specified

Can someone help me with this error?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: cardshrk31 on January 27, 2009, 10:56:57 pm
Sorry for the multiple post. I wanted to include my theme.php and my upload.php files.

Thanks for the help
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: cardshrk31 on January 28, 2009, 04:44:30 pm
Well one more post. I fixed my issue. I missed some code during the original edit. Everything is working fine now. Thanks for the mod it works great. Nibbler you the man!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Cath22 on January 30, 2009, 01:00:43 pm
I would like to display videos from video.yahoo.com
Didnt find anything in the search except this one, I tried this mod, but didnt work.
How could this be modified for Videos hosted on Yahoo??

Thanks in advance
Cath
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: nidhhog on February 11, 2009, 03:12:56 pm
I did everything what i've read here, but now , instead a uploaded video from youtube I see just a picture.

Let's say:
I am uploding http://www.youtube.com/watch?v=2Dh4UE_yRHw  , but gallery showed me ....... 2Dh4UE_yRHw.jpg  picture.
It automaticlyy make picture.


What is wrong? What shoul I do? Couf u help me ?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 11, 2009, 03:18:50 pm
Means you didn't edit the theme correctly.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: nidhhog on February 14, 2009, 10:17:12 am
Yes. You was right. It's work perfect now, but only administrator of this page can add a you tube file.
Do you know how to edit/upgrade this code, to make able upload youtube videos by non register users?
 You tube upload form  is visble only for admin  :-\
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: nidhhog on February 23, 2009, 03:34:33 pm
Please,

Does anybody know how to enable adding youtube videos for registred and non-registred users ?? It is possible for admin only now :(

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on February 23, 2009, 05:31:22 pm
change

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';
}

to

Code: [Select]
           // 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';
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on February 25, 2009, 04:44:02 pm
FYI: For everyone who has fopen() disabled (or problems installing this mod), I created this mod (http://forum.coppermine-gallery.net/index.php/topic,58222.0.html).
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tpr on March 06, 2009, 09:46:52 pm
Hi guys I seem to have an odd problem.
It appears as though some IE users can not view the youtube movies (receive an error that the page can not be displayed).
Can't figure out whats the problem as the site works fine on FF, ran through an html validation and didn't come up with anything that should cause this.
http://www.yehida.co.il/gallery/displayimage.php?pos=-1790


Any ideas ?

p.s.
the site is heavily modified (integration between coppermine, vbulletin and joomla) however the problem only occur with the youtube movies.

Thanks,
Guy N.

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hein Traag on March 07, 2009, 08:51:10 am
tpr you need to upgrade first to 1.4.21
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tpr on March 07, 2009, 09:18:06 am
Hein,
I plan to do that before taking the site online but I'm trying to locate (and solve) the movie problem now as the upgrade is bound to create several new bugs (will probably break at least some of the integration components/templates)

Also, unless I'm wrong this is not a "known" issue that has been solved in the new version, in fact I'm fairly sure it has something to do with either the youtube or the Joomla integration plugins

Guy
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on March 09, 2009, 09:11:13 am
It already is online as we talk - the internet is "live". Google has already indexed this very discussion, so the link is available as well. They have started spidering as well.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: tpr on March 09, 2009, 10:21:06 am
I can't really ask for your advise on the site, if its locked.
Having said that, taking the site online usually requires a bit more than just opening it (like telling the users the new site is open at xxx etc.)

In any case, the problem was solved (not coppermine related)
Thanks for the help anywayz.

 
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Shinji89 on April 01, 2009, 06:47:57 pm
Hi,
I did everything what i've read here, but i got always a messagge after upload and set description that say: "The file may not be entered." I'm using the versione with no dev code. I have attached the two files, if someone can help me I would be really grateful:) and sorry for my bad English
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Shinji89 on April 01, 2009, 06:51:29 pm
These are the files ... I don't know why they were not taken in the last message :\
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: fil6718 on April 24, 2009, 07:01:19 pm
Hello,

After 3 days, it doesnt work on my gallery.
I've this error message :
YT errors:
URI                        Error message
1. VXMd8wgJ8Y0        Failed to find video

Someone can help me ?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on April 24, 2009, 07:54:06 pm
You need to read the instructions more carefully.

Quote
Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx

That means to add the video VXMd8wgJ8Y0 you enter http://www.youtube.com/watch?v=VXMd8wgJ8Y0 as the URL.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: fil6718 on April 24, 2009, 09:19:02 pm
Thanks a lot
I have try during 3 days, change and rechange upload.php and theme.php, with the old version and the new.  >:(
I haven't see the simply and basic think  :P

Have a good day

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: forester on April 26, 2009, 07:01:29 am
Great mode!

Some tricks:

For autostart: &autoplay=1
For Full Screen: &fs=1

You add those and and as many other optional settings as you need
in your theme.php while setting the URL of the clip:

<object width=320" height="240"><name="movie" value="http://www.youtube.com/v/'. $vid . '&autoplay=1&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="transparent" autostart="true"></param><embed src="http://www.youtube.com/v/'. $vid . '&autoplay=1&fs=1" type="application/x-shockwave-flash" wmode="transparent" width="320" height="240" autostart="true" allowfullscreen="true"></embed></object><br />
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: fil6718 on April 28, 2009, 12:11:34 am
Hello,

I've try to change my theme.php but nothing change on my site.
I have copy all the function theme_html_picture in the theme that i use, change the parametres to have autostart but nothing.
I have the impression that what i change, it's always the same.
Did I use the good page ?

Some one can help me ?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeepguy_1980 on July 27, 2009, 04:38:44 am
I tried out this mod and found that it conflicts with the LightBox Slideshow Plugin v1.1 (http://forum.coppermine-gallery.net/index.php/topic,59013.msg290739.html#msg290739).  I have made a version 1.2.  The conflict was causing the video to show up as a picture.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on July 27, 2009, 07:43:51 am
We'd love to see your improved version that fixes the collission. Please zip it and attach it to your posting if you're ready to share.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeepguy_1980 on July 27, 2009, 02:20:59 pm
I should have mentioned that I posted the updated version in the LightBox plugin thread.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 08:47:39 am
   
I have the following problem

my domain:

http://gbbilder.eu/displayimage.php?album=1&pos=0 (http://gbbilder.eu/displayimage.php?album=1&pos=0)

   
for me, only the image displayed


   
no video what I do wrong?

   
have enter the youtube url

http://www.youtube.com/watch?v=FWYtTmEUAj0

   
but only the building would not be taken over the video


   
can someone help me?

thanks in advance
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2009, 12:12:56 pm
Means you didn't apply the changes to your theme properly or at all. Also possible you have a plugin that overrides the theme.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 03:20:07 pm
my theme is igames

I have but only in the following standard theme found


theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)

i cant find this in igames theme

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;
      }
   }
}


   
or do I have the code so there simply paste?

should I use my time here IGAM theme.php upload?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2009, 04:29:20 pm
You have PHP5 so you can skip that step.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 04:35:42 pm
   
but why it works for me then do not?

http://www.gbbilder.eu (http://www.gbbilder.eu)

times they try it themselves gast is open access
it is only the video image on any display
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2009, 04:40:04 pm
Means you didn't apply the changes to your theme properly or at all. Also possible you have a plugin that overrides the theme.

Zip and attach your theme.php, try disabling any plugins that may conflict.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 04:47:54 pm
   
I have just as a test and disable plugins    
still  tries to insert youtube video it will still appear only as a visual

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2009, 05:19:17 pm
As expected, you haven't actually modifed your theme.php.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 05:21:35 pm
they could for me to adapt the theme? that would be really nice of them
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: jeepguy_1980 on July 29, 2009, 05:48:22 pm
The theme.php modification should been the easiest to make. But if you can't figure it out, applying the LightBox (http://forum.coppermine-gallery.net/index.php/topic,59013.0.html) plugin will fix your theme problems. But it will also cause all of your regular pictures to popup in a LightBox slideshow.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 05:52:00 pm
   
yes I know I can only text in this theme meinr not find


-------------

find

Code: [Select]
if (isset($image_size['reduced'])) {
Change to

Code: [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'])) {


therefore, it would be great if they would edit my theme
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on July 29, 2009, 05:52:59 pm
The instructions say what to do if you can't find the code. Copy theme_html_picture() over from sample theme (themes/sample/theme.php) and then apply the change.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 06:08:01 pm
oh sorry but my english is very bad i can't understand you

i can find in my sample theme that: Copy theme_html_picture()

but in my igames theme can't find this text

   
sry but what should I do with the text make clear?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on July 29, 2009, 06:09:51 pm
Copy it to your theme.php! Or in German: Kopiere die Passage aus der Datei sample/theme.php in deine theme.php ::)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 06:16:38 pm
Copy it to your theme.php! Or in German: Kopiere die Passage aus der Datei sample/theme.php in deine theme.php ::)


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 ?

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on July 29, 2009, 06:19:56 pm

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 ?
Don't speak German here! I just translated a very easy sentence that you don't understand many times before.

Before you ask more stupid questions, copy this to your theme.php file and modify it:
Code: [Select]
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&amp;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.)

 >:(
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Hardstyle-boy on July 29, 2009, 07:24:27 pm

sorry

i have    
adapted my sample / theme.php

or    
I have my igames theme.php  to adapt?

i load a  up a  video youtube

Datei - youtube_Pa7SzjL0lHg.jpg <- that format is wrong

Bitte Dateien jetzt den Alben zuordnen. Es können jetzt zusätzliche Angaben zu den Dateien gemacht werden.

Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on July 29, 2009, 09:14:55 pm
You have to edit your theme.php: themes/igame/theme.php. Please use your brain or a dictionary. ::)

If you don't speak English, the ask your question in the language specific support boards. The saddest is: you don't understand it even when we explain it in German :o
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on July 29, 2009, 10:56:34 pm
OK, this needs to end, as it is not related to the mod, but the user's inability to perform the needed edits. The mod is not meant for you. Hire someone to apply it if you still need it. Stay out of this announcement thread, you're cluttering it.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: stevem on August 24, 2009, 10:07:50 pm
I was having problems with this script that I debugged down to the fact that my ISP has allow_url_fopen=false configured so I cannot open the thumbnail URL with the supplied code. I replaced the following code

Code: [Select]
                               $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);

with this code (which I think looks cleaner anyway: no looping) and it works like a charm.

Code: [Select]
                $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);

Additionally, I noticed that the following code (just above the code that I replaced above) is all dead as $xdata is not used (as per the "todo" comment):

Code: [Select]
$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)){

Steve
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Jesusonamoped on September 02, 2009, 12:00:44 pm
Many thanks to Takako on page 16 for his compilation of what has been said.

Although I am not a coder by any means it worked first time for me.  :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: mrpepsi on September 15, 2009, 04:04:34 am
i can not get this to work since i upgraded to 1.4.25. i apply all steps, then after i upload and it asks what album to put the file in it takes me back to the upload page.
my gallery is here but i took this off cause it was messing with the upload page.
http://eastgermanshepherdpups.com


will this be built into 1.5?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on September 15, 2009, 09:08:27 am
will this be built into 1.5?
No. But there will be a similar plugin.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: cpmbr on October 19, 2009, 03:06:00 am
According to Youtube
http://www.youtube.com/dev

The older API is officially deprecated.
And it is not possible to create API ID. Because it is unnecessary.
I do not have my ID

Does anyone know how to update this modification of coppermine for the new API?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Nibbler on October 19, 2009, 10:04:51 am
Yes. Read the thread.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: cpmbr on October 20, 2009, 01:51:32 am
I did all the procedure on page 15
but an error message. (sent attached)

Already remade this step several times.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on October 20, 2009, 09:01:15 am
Stop misbehaving! You have been told what you need to do previously, e.g. in http://forum.coppermine-gallery.net/index.php/topic,62115.msg308211.html#msg308211
Next misbehaviour will result in a ban.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: JTPickering on October 31, 2009, 07:05:24 am
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.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ShiversOfHorror on November 06, 2009, 12:14:53 am
This worked great on first attempt!


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.

Make the edits in the first post. THEN apply the edits in this post: http://forum.coppermine-gallery.net/index.php/topic,37962.msg264919.html#msg264919

If you scroll down a post or two there are codes to change the colors and make it so it can go full screen.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: timbuktu on November 06, 2009, 08:41:25 pm
Hello,
    could you tell me if i use the different theme , and the code you told not available there, then we should i do , what if use
different theme?? i can' find any code in my theme except in sample's template, and i don't want to use that for my site,
Kindly let me know if i can do it in same way with my different template .

Thanks with Regards,
Timbuktu
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on November 11, 2009, 09:10:21 am
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: timbuktu on November 14, 2009, 02:02:00 am
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 .
 
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on November 14, 2009, 10:13:42 am
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!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: sixgill on December 18, 2009, 07:57:12 pm
Can someone post how to do this in 1.5.2 please?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on December 18, 2009, 08:28:58 pm
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.)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on December 20, 2009, 09:27:28 pm
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)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: MjrGaelic on January 31, 2010, 07:35:50 am
Just wanted to say thank-you for this mod.  I have it working great on my site at www.starbase39.com/media (still working on the site/template as of this posting).

Regards,
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: computethisnow on February 09, 2010, 03:08:34 pm
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 find

Code: [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';
}
         
         
Find         

Code: [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.
     
Find

Code: [Select]
     
     $zip_error_count = count($zip_failure_array);

After, add

Code: [Select]
     
      $YT_error_count = count($YT_failure_array);
     
Find

Code: [Select]
   
        // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count) > 0) {
   
Change to

Code: [Select]
   
        // Create error report if we have errors.
    if (($file_error_count + $URI_error_count + $zip_error_count + $YT_error_count) > 0) {
     
Find

Code: [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>";

            }

        }
       
Find

Code: [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)

Find

Code: [Select]
if (isset($image_size['reduced'])) {

Change to

Code: [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 gone over and over these steps and when I try to upload youtube link i keep getting error message just stating YT errors:
URI   Error message
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on February 11, 2010, 07:35:29 am
Instead of quoting the instructions (we already know them, so there's no need to clutter this thread with that quote) you should have done as suggested per board rules (http://forum.coppermine-gallery.net/index.php/topic,55415.0.html) for a start: posting a link to your gallery (http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616) is mandatory.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ygl on February 22, 2010, 01:33:49 pm
I have exactly the same problem here! Plz help me to fix this problem.

Hi,

I have exactly the same problem in my gallery: youtube videos work correctly, but I can't upload files.

I've read the whole thread but I don't find the solutions. Anybody knows how to solve this?

Thank you very much in advance.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ygl on February 22, 2010, 01:35:13 pm
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....

Hi, sorry, here is the right quote, with all the information.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on February 23, 2010, 07:28:02 am
jape's posting is invalid. Yours therefore is invalid as well. I suggest you read up board rules first, especially
If you have an issue with regular uploads, do as suggested in the docs, section "asking for support on upload issues" in a thread of your own on the upload support board. If you have an issue with the mod that is being discussed in this very thread, don't bother to refer to someone else's posting that contains hotlinked images that display screenshots of the regular upload process, but do as I suggested above and post a link to your gallery and write what your actual question or issue is (in your own words, not quoting someone else's invalid posting).
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: atomis on April 09, 2010, 11:49:50 am
Hi , I was changed upload.php and I have to change theme.php but I don´t understand what I have to do.

What I have to change in sample theme?

I find theme_html_picture and then?

http://img407.imageshack.us/img407/898/codeg.jpg (http://img407.imageshack.us/img407/898/codeg.jpg)

Sorry for my english.

Thanks


theme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)

Find

Code: [Select]
if (isset($image_size['reduced'])) {

Change to

Code: [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.
[/quote]
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on April 09, 2010, 12:14:05 pm
You have to copy the whole function from sample/theme.php to your theme's theme.php. You don't have to change anything in sample/theme.php!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bistick on April 13, 2010, 02:25:17 am
Great mod ... It works well. But now I'm in front of a mystery. I tried to change the code to customize embedded YouTube player, but I can not see the change. In theme.php I write what I want in $ pic_html, but eventually receive the old player with the correct video. I can even assign $ pic_html =''and displays the same player! is incredible. Help me understand what happens! At the end of the file, if you replace this code
Code: [Select]
$ CURRENT_PIC_DATA ['html'] = $ pic_html;
$ CURRENT_PIC_DATA ['header'] ='';
$ CURRENT_PIC_DATA ['footer'] ='';

with
Code: [Select]
$ CURRENT_PIC_DATA ['html'] = $ pic_html;
$ CURRENT_PIC_DATA ['header'] = $ pic_html;
$ CURRENT_PIC_DATA ['footer'] = $ pic_html;

I get three replicas of the player (or image), but the central one remains in its original form (the wrong)! is absolutely incredible!

why i can't update $ CURRENT_PIC_DATA ['html']? is there a cached version?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bistick on April 13, 2010, 11:24:21 am
oh it's amazing!! if I replage old theme.php I can stil see the youtube video after refresh and cleaning of browser cache!!!
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: bistick on April 13, 2010, 12:49:54 pm
Please test my problem. There is an Attached file below.

Thankyou
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on April 22, 2010, 09:58:58 pm
Wickled Nibbler nice work, just what I was after!  8)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on April 26, 2010, 03:59:35 pm
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 .
 

Did you figure out if this error is due to fOpen not being supported on the server then?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: andy_cul on April 27, 2010, 12:16:12 am
can you use this MOD on redtube(warning adult content)?
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on April 28, 2010, 12:36:01 pm
Find it out and report back here if you think that others will benefit from your report.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on May 01, 2010, 12:02:34 am
To update this mod for the new API, try the following:

find

Code: [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 to

Code: [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 find

Code: [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 to

Code: [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.

I get a syntax error when changing the URI error part of the code.
Parse error: syntax error, unexpected $end in /home/actionfo/public_html/gallery/upload.php  on line 2726

Code: [Select]
//} else {
// $YT_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'URI_name'=> $YT_URI, 'error_code'=> $xdata);
//}

I have attached the upload.php file which is the curl version, with the API changes.

Gallery url: http://actionforcetoys.com/gallery/
Server info:
Operating system     Linux
Apache version     2.2.15
PHP version    5.3.2

Thanks in advance.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on May 11, 2010, 07:05:43 pm
Strange, I have both enabled now...
allow_url_fopen   On
cURL support    enabled

And neither script will work for me :(
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on May 11, 2010, 08:57:28 pm
I got it working with fOpen eventually.  Cool :)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: frankistrade on July 08, 2010, 12:58:08 pm
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
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: frankistrade on July 08, 2010, 03:57:50 pm
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

Soved my problem (looked through some other peoples upload.php files and got it, not quite sure what it was), however, I have noticed one more problem. The titles or description do not seem to automatically appear as the should according to the mod description, after upload. I noticed a few others had this problem by reading through the thread, but they never got it solved (either because they never replied or didn't get any support). I have uploaded my two files below, plus created a testing account.

http://www.frankstrade.co.uk/gallery
Username: testor
Password: testor

Many thanks.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on July 10, 2010, 04:52:44 pm
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

Yeah sure, I'll post the working scripts when I get on my main computer.  The guys site is down so I can't grab them off there right now.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on July 20, 2010, 02:31:08 pm
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

See attached scripts.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: migzy on July 20, 2010, 02:35:43 pm
Sorry ignore index.txt above, here is the theme script, it was a mod of the hardwired theme.php.
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: ShiversOfHorror on August 29, 2010, 04:21:07 am
Any way to get this to work on 1.5.8? I know there is the Remote Videos plugin, but I don't think I'm going to like it, and I love the way this one works. I've spent 2-3 days working on recreating my theme for 1.5.8, but I can't switch unless I get videos working.

I know nothing about coding php myself
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Joachim Müller on September 13, 2010, 07:48:29 am
Don't ask for other versions (http://forum.coppermine-gallery.net/index.php/topic,24540.0.html)
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: profili on August 02, 2011, 03:01:14 pm
Nibbler, do you have some time to make this hack work for 1.5 CPG too? This would be great.

Regards
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: Αndré on August 02, 2011, 03:33:32 pm
You could try that plugin: http://forum.coppermine-gallery.net/index.php/topic,60195.0.html
Title: Re: Displaying videos from Youtube in Coppermine.
Post by: profili on August 03, 2011, 01:13:32 am
Thank you André, but that plugin is not what I need. I used to have installed this hack from Nibbler and now with CPG 1.5 all videos are not working anymore. Another reason is the fact that remote videos plugin is not that handy to use; there is no field to add the YT url, but you have to create a file with the url, etc....