Displaying videos from Youtube in Coppermine. - Page 19 Displaying videos from Youtube in Coppermine. - Page 19
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Displaying videos from Youtube in Coppermine.

Started by Nibbler, October 31, 2006, 03:42:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hardstyle-boy

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?

Nibbler


Hardstyle-boy

   
but why it works for me then do not?

http://www.gbbilder.eu

times they try it themselves gast is open access
it is only the video image on any display

Nibbler

Quote from: 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.

Zip and attach your theme.php, try disabling any plugins that may conflict.

Hardstyle-boy

   
I have just as a test and disable plugins    
still  tries to insert youtube video it will still appear only as a visual


Nibbler

As expected, you haven't actually modifed your theme.php.

Hardstyle-boy

they could for me to adapt the theme? that would be really nice of them

jeepguy_1980

The theme.php modification should been the easiest to make. But if you can't figure it out, applying the LightBox plugin will fix your theme problems. But it will also cause all of your regular pictures to popup in a LightBox slideshow.

Hardstyle-boy

   
yes I know I can only text in this theme meinr not find


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

find

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

Change to

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

Nibbler

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.

Hardstyle-boy

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?

Αndré

Copy it to your theme.php! Or in German: Kopiere die Passage aus der Datei sample/theme.php in deine theme.php ::)

Hardstyle-boy

Quote from: eenemeenemuu 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 ::)


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 ?


Αndré

Quote from: Hardstyle-boy on July 29, 2009, 06:16:38 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:
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.)

>:(

Hardstyle-boy


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.


Αndré

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

Joachim Müller

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.

stevem

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


                               $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.


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

$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

Jesusonamoped

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

mrpepsi

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?