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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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.

atomis

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

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


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



If you get this message when you upload:

then your dev_id is probably wrong.
[/quote]

Αndré

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!

bistick

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

$ CURRENT_PIC_DATA ['html'] = $ pic_html;
$ CURRENT_PIC_DATA ['header'] ='';
$ CURRENT_PIC_DATA ['footer'] ='';


with

$ 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?
San Costantino Calabro

bistick

oh it's amazing!! if I replage old theme.php I can stil see the youtube video after refresh and cleaning of browser cache!!!
San Costantino Calabro

bistick

Please test my problem. There is an Attached file below.

Thankyou
San Costantino Calabro

migzy

Wickled Nibbler nice work, just what I was after!  8)

migzy

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


Did you figure out if this error is due to fOpen not being supported on the server then?

andy_cul

can you use this MOD on redtube(warning adult content)?

Joachim Müller

Find it out and report back here if you think that others will benefit from your report.

migzy

Quote from: Nibbler on August 09, 2008, 06:45:30 PM
To update this mod for the new API, try the following:

find


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


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



// 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



// 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


//} 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.

migzy

Strange, I have both enabled now...
allow_url_fopen   On
cURL support    enabled

And neither script will work for me :(

migzy

I got it working with fOpen eventually.  Cool :)

frankistrade

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

frankistrade

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

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.

migzy

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

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.

migzy

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

See attached scripts.

migzy

Sorry ignore index.txt above, here is the theme script, it was a mod of the hardwired theme.php.

ShiversOfHorror

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

Joachim Müller


profili

Nibbler, do you have some time to make this hack work for 1.5 CPG too? This would be great.

Regards