Advanced search  

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]

Pages: 1 ... 12 13 14 15 [16] 17 18 19 20 ... 22   Go Down

Author Topic: Displaying videos from Youtube in Coppermine.  (Read 432399 times)

0 Members and 2 Guests are viewing this topic.

himaloy

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Displaying videos from Youtube in Coppermine.
« Reply #300 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?
Logged

zylys

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Displaying videos from Youtube in Coppermine.
« Reply #301 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
Logged

fangweile

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 103
  • Saranghaeyo ^_^
    • All Koreans - Home of Korean Actors and Actresses
Re: Displaying videos from Youtube in Coppermine.
« Reply #302 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.
Logged
[My Coppermine Galleries]
All Koreans, Lim Eun-kyeong's IFC
Saranghae 김태희

shaney

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Displaying videos from Youtube in Coppermine.
« Reply #303 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Displaying videos from Youtube in Coppermine.
« Reply #304 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 as well.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Displaying videos from Youtube in Coppermine.
« Reply #305 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
Logged

tutt

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Displaying videos from Youtube in Coppermine.
« Reply #306 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
Logged

Nibbler

  • Guest
Re: Displaying videos from Youtube in Coppermine.
« Reply #307 on: November 06, 2008, 01:16:58 pm »

You probably didn't edit upload.php correctly.
Logged

Timos-Welt

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 808
    • Timos-Welt
Re: Displaying videos from Youtube in Coppermine.
« Reply #308 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? 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
Logged

tutt

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Displaying videos from Youtube in Coppermine.
« Reply #309 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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Displaying videos from Youtube in Coppermine.
« Reply #310 on: November 06, 2008, 08:58:29 pm »

There's a paid support board 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.
Logged

jesusarmy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 34
Re: Displaying videos from Youtube in Coppermine.
« Reply #311 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 ?

Logged

duerre

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Displaying videos from Youtube in Coppermine.
« Reply #312 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.
Logged

troy77

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Displaying videos from Youtube in Coppermine.
« Reply #313 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
Logged

Takako

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Displaying videos from Youtube in Coppermine.
« Reply #314 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:


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

Takako

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Displaying videos from Youtube in Coppermine.
« Reply #315 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?

Logged

Nibbler

  • Guest
Re: Displaying videos from Youtube in Coppermine.
« Reply #316 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" ',
Logged

Takako

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Displaying videos from Youtube in Coppermine.
« Reply #317 on: December 02, 2008, 04:04:38 pm »

Thankyou very much for your prompt response Nibbler
Everything is working now~~

Cheers!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Displaying videos from Youtube in Coppermine.
« Reply #318 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?
Logged

Nibbler

  • Guest
Re: Displaying videos from Youtube in Coppermine.
« Reply #319 on: December 03, 2008, 01:17:49 pm »

Committed there too.
Logged
Pages: 1 ... 12 13 14 15 [16] 17 18 19 20 ... 22   Go Up
 

Page created in 0.035 seconds with 21 queries.