Advanced search  

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

Pages: 1 ... 17 18 19 20 [21] 22   Go Down

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

0 Members and 1 Guest are viewing this topic.

atomis

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

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Displaying videos from Youtube in Coppermine.
« Reply #401 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!
Logged

bistick

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • http://www.sancostantinocalabro.net/
    • http://www.sancostantinocalabro.net/
Re: Displaying videos from Youtube in Coppermine.
« Reply #402 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?
Logged
San Costantino Calabro

bistick

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • http://www.sancostantinocalabro.net/
    • http://www.sancostantinocalabro.net/
Re: Displaying videos from Youtube in Coppermine.
« Reply #403 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!!!
Logged
San Costantino Calabro

bistick

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • http://www.sancostantinocalabro.net/
    • http://www.sancostantinocalabro.net/
Re: Displaying videos from Youtube in Coppermine.
« Reply #404 on: April 13, 2010, 12:49:54 pm »

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

Thankyou
Logged
San Costantino Calabro

migzy

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Displaying videos from Youtube in Coppermine.
« Reply #405 on: April 22, 2010, 09:58:58 pm »

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

migzy

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

andy_cul

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 63
  • Incigida
Re: Displaying videos from Youtube in Coppermine.
« Reply #407 on: April 27, 2010, 12:16:12 am »

can you use this MOD on redtube(warning adult content)?
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 #408 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.
Logged

migzy

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

migzy

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

migzy

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Displaying videos from Youtube in Coppermine.
« Reply #411 on: May 11, 2010, 08:57:28 pm »

I got it working with fOpen eventually.  Cool :)
Logged

frankistrade

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

frankistrade

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

migzy

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

migzy

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

migzy

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

ShiversOfHorror

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Female
  • Posts: 60
Re: Displaying videos from Youtube in Coppermine.
« Reply #417 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
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 #418 on: September 13, 2010, 07:48:29 am »

Logged

profili

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 113
Re: Displaying videos from Youtube in Coppermine.
« Reply #419 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
Logged
Pages: 1 ... 17 18 19 20 [21] 22   Go Up
 

Page created in 0.026 seconds with 20 queries.