forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Uploading => Topic started by: Αndré on February 25, 2009, 09:37:56 am

Title: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on February 25, 2009, 09:37:56 am
Because Nibbler's Youtube mod (http://forum.coppermine-gallery.net/index.php/topic,37962.0.html) doesn't work for me (I'm using a freehoster with PHP URL fopen disabled), I created another method to "upload" Youtube videos to your Coppermine gallery.

Open themes/<yourtheme>/theme.php and copy the function theme_html_picture() from themes/sample/theme.php to your theme.php, if it isn't already there.

Search
Code: [Select]
        $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";
and replace it with
Code: [Select]
        if ($mime_content['extension'] == "youtube") {
            // get content of .youtube file
            $youtube_file_content = file_get_contents($picture_url);
            // remove apostrophes and quotes
            $youtube_file_content = str_replace("'", "", $youtube_file_content);
            $youtube_file_content = str_replace("\"", "", $youtube_file_content);
            // get youtube video id
            $youtube_file_content = str_replace("http://www.youtube.com/watch?v=", "", $youtube_file_content);
            $youtube_file_content = explode("&", $youtube_file_content);
            $youtube_video_id = $youtube_file_content[0];
            // check if video id is valid
            if (strlen($youtube_video_id) == "11") {
                $youtube_check_result = preg_match("/[A-Za-z0-9_-]{11}/", $youtube_video_id, $youtube_video_id_valid);
            }
            // embed video or print error message
            if ($youtube_check_result == "1" ) {
                $pic_html = "<embed type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"640\" height=\"385\" src=\"http://www.youtube.com/v/{$youtube_video_id_valid[0]}&hl=de&fs=1\" />";
            } else {
                $pic_html = "Error: no valid youtube video id";
            }
        } else {
            $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";
        }

Next you have to add the filetype ".youtube" to the database. Download the attached file, copy it to your cpg root directory and call it in your browser.

To add a Youtube video to your gallery, you have to create a file with the extension ".youtube". The file should contain the youtube video ID (e.g. if you watch the video http://www.youtube.com/watch?v=6B26asyGKDo, the video ID is 6B26asyGKDo). The whole youtube url should also work, but if you copy only the ID into your file, you are on the safe side.

At least check if the youtube filetype is allowed in the config. If all is done, you can upload your .youtube files like every other file.

The thumbnail for the video can be created as described here (http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#cust_thmb).
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Nibbler on February 25, 2009, 04:52:49 pm
You should check that the format of the video ID is valid before you use it for security reasons.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on February 25, 2009, 04:57:43 pm
Any hint where to begin? I've never dealt with this before :-X

The only idea I have is deleting all " and ' . Which security issues do you see in my mod?
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on February 26, 2009, 09:34:29 am
I added some lines in my first post. It extracts the video id and checks for string length and unvalid characters.
Can you evaluate my changes Nibbler? Is it a security improvement?
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Cath22 on February 26, 2009, 02:25:56 pm
Hi there,

Will this also work for other sites, like for instance Yahoo? I have some videos there I would like to share.

Thanks in advance
Greetz
Cath
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on February 26, 2009, 02:44:35 pm
This method should work for all websites that provide an embed code for their videos. Currently my mod supports Youtube only.

The whole idea is, that the user uploads a file with a video id. Coppermine reads this video id out of the file and places it in the given html embed code. The result is the embed code with the video id, that looks just as the provided embed code of the according website.

The code for Yahoo video could look like:
Code: [Select]
        if ($mime_content['extension'] == "yahoo") {
            $pic_html = '<embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.34" type="application/x-shockwave-flash" width="512" height="322" allowFullScreen="true" AllowScriptAccess="always" bgcolor="#000000" flashVars="id='.file_get_contents($picture_url).'&embed=1" />';
        }
Of course the filetype has to be added to the database, too. This has not been tested and is beyond the intention of this mod.


If you understand how this method works, it should be very easy to adapt it to your needs.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Cath22 on February 26, 2009, 03:37:53 pm
This method should work for all websites that provide an embed code for their videos. Currently my mod supports Youtube only.

The whole idea is, that the user uploads a file with a video id. Coppermine reads this video id out of the file and places it in the given html embed code. The result is the embed code with the video id, that looks just as the provided embed code of the according website.


If you understand how this method works, it should be very easy to adapt it to your needs.

I'm not completely sure how it works, but hell I'll give it a try,  ;D we'll keep on triying to make it all better right.
Thanks for your reply.

Cath
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: concreto on May 25, 2009, 05:27:53 am
hi
any one could post a demo  to see if there´s any diffrenece with nibbler´s method...
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on May 26, 2009, 10:49:23 am
There's no difference in displaying the video.

Example with Nibbler's mod: http://gelipo.com/members/Nibbler/pictures/61993
Example with my mod: http://eenemeenemuu.ee.funpic.de/cpg14x/displayimage.php?pos=-2


My mod lacks of these features:
A new section appears on the upload page where you enter the URL of the video.
You have to create a file with the extension '.youtube' and upload it (like an image) with my mod.

Coppermine will use the video thumbnail and title/caption/keywords from Youtube when adding the video.
This isn't possible with PHP URL fopen disabled.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: concreto on May 27, 2009, 05:35:39 am
ok thanks i´ll try your method soon.... looks good
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Joachim Müller on May 27, 2009, 07:43:44 am
Example with Nibbler's mod: http://gelipo.com/members/Nibbler/pictures/61993
Gelipo is not a good example - they deliberately hide the "Powered by Coppermine" tag, which makes their hacked copy of Coppermine an illegal one. They have been made aware of this, but they ignore the fact that they're running an illegal version. They fail to give credit where credit is due, which is just lame imo. I suggest not to advertize their site as an example for anything except as for silly and rude behaviour.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on May 27, 2009, 07:54:28 am
Thanks for the hint Joachim. I hadn't noticed that they hide out footer. I just copied the link out of Nibbler's announcement thread.

//Edit: They hide the tag, but they display an image instead. See attachment.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Nibbler on May 27, 2009, 12:45:21 pm
I've put back the text link. Logo was nicer though I thought.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: top10ufo on October 06, 2009, 09:20:54 pm
Thanks for this mod, Αndré. My host doesn't allow fopen, so this is great. It's going to save me alot of bandwidth now as well instead of hosting the videos myself.

 ;D Thanks again!  ;D

You can see the mod in action here:
http://www.top10ufo.com/photos/index.php?cat=5 (http://www.top10ufo.com/photos/index.php?cat=5)
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: timbuktu on November 11, 2009, 03:16:08 am
kindly tell me in which root should we put the add_filetyp.php ?? in theme or in public_html?? Thanks with Regards
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on November 11, 2009, 09:04:22 am
copy it to your cpg root directory
= your Coppermine directory where e.g. index.php is located.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: timbuktu on November 12, 2009, 08:38:56 am
Andre , Could you please tell me that if i'm using different template in which there is no such code you told us to find and replace with the code give, then what should i do ?? you can see that attached file with name theme, kindly let me know i'll be really very thankful to you,

With Regards,
Nomi
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Αndré on November 12, 2009, 09:21:21 am
Andre , Could you please tell me that if i'm using different template in which there is no such code you told us to find and replace with the code give, then what should i do ??
Read my instructions in the initial post!

Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: DigiMajik on January 03, 2010, 06:43:31 am
Thanks for this mod and the outstanding documentation.

http://www.thewarcenter.net/gallery/
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: dmosley on March 08, 2010, 12:07:42 am
Thanks for the mod! Worked like a charm!
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: sevencreations on May 31, 2010, 04:20:54 am
HI can you guys please help me with the coding of theme.php i m new here please help me guys :(


Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly 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.2
  $Source: /cvsroot/coppermine/devel/themes/Rando-des-Bois/theme.php,v $
  $Revision: 2.01 $
  $Author: PYAP $
  $Date: 2005/12/29 11:02:18 $
**********************************************/
/*
Theme CPG 1.4.3 Rando des Bois conçu par PYAP 29-12-2005
*/
// ------------------------------------------------------------------------- //
// This theme has had redundant CORE items removed                           //
// ------------------------------------------------------------------------- //
define('THEME_HAS_RATING_GRAPHICS'1);
define('THEME_HAS_NAVBAR_GRAPHICS'1);
define('THEME_HAS_NO_SYS_MENU_BUTTONS'1);
define('THEME_HAS_NO_SUB_MENU_BUTTONS'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 sys menu
$template_sys_menu = <<<EOT
                        <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
<!-- BEGIN home -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleftmy" src="themes/Woody-ZONE/images/buttonleftmy.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{HOME_TGT}" title="{HOME_TITLE}">{HOME_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END home -->
<!-- BEGIN my_gallery -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleftmy" src="themes/Woody-ZONE/images/buttonleftmy.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}">{MY_GAL_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END my_gallery -->
<!-- BEGIN allow_memberlist -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft" src="themes/Woody-ZONE/images/buttonleftmemb.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}">{MEMBERLIST_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END allow_memberlist -->
<!-- BEGIN my_profile -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft" src="themes/Woody-ZONE/images/buttonleft.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{MY_PROF_TGT}" title="{MY_PROF_LNK}">{MY_PROF_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END my_profile -->
<!-- BEGIN faq -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft" src="themes/Woody-ZONE/images/buttonleftfaq.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                        <a href="{FAQ_TGT}" title="{FAQ_TITLE}">{FAQ_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END faq -->
<!-- BEGIN enter_admin_mode -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleftad" src="themes/Woody-ZONE/images/buttonleftad.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{ADM_MODE_TGT}" title="{ADM_MODE_TITLE}">{ADM_MODE_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END enter_admin_mode -->
<!-- BEGIN leave_admin_mode -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleftad" src="themes/Woody-ZONE/images/buttonleftad.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{USR_MODE_TGT}" title="{USR_MODE_TITLE}">{USR_MODE_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0" alt="" /></td>
<!-- END leave_admin_mode -->
<!-- BEGIN upload_pic -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleftup" src="themes/Woody-ZONE/images/buttonleftup.gif" width="17" height="25" border="0" alt="" /></td>
                                       <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}">{UPL_PIC_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END upload_pic -->
<!-- BEGIN register -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft" src="themes/Woody-ZONE/images/buttonleft.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{REGISTER_TGT}" title="{REGISTER_TITLE}">{REGISTER_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END register -->
<!-- BEGIN login -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleft" src="themes/Woody-ZONE/images/buttonleft.gif" width="17" height="25" border="0" alt="" /></td>
                                       <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{LOGIN_TGT}" title="{LOGIN_LNK}">{LOGIN_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0"  alt="" /></td>
<!-- END login -->
<!-- BEGIN logout -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
                                        <td><img name="buttonleftout" src="themes/Woody-ZONE/images/buttonleftout.gif" width="17" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{LOGOUT_TGT}" title="{LOGOUT_LNK}">{LOGOUT_LNK}</a>
                                        </td>
                                        <td><img name="buttonright" src="themes/Woody-ZONE/images/buttonright.gif" width="7" height="25" border="0" alt="" /></td>
<!-- END logout -->
                                </tr>
                        </table>

EOT;

// HTML template for sub menu
$template_sub_menu = <<<EOT

                        <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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{CUSTOM_LNK_TGT}" title="{CUSTOM_LNK_TITLE}">{CUSTOM_LNK_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                       <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{LASTUP_TGT}" title="{LASTUP_LNK}">{LASTUP_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                       <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{LASTCOM_TGT}" title="{LASTCOM_LNK}">{LASTCOM_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{TOPN_TGT}" title="{TOPN_LNK}">{TOPN_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{TOPRATED_TGT}" title="{TOPRATED_LNK}">{TOPRATED_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{FAV_TGT}" title="{FAV_LNK}">{FAV_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.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/Woody-ZONE/images/buttonleft1.gif" width="7" height="25" border="0" alt="" /></td>
                                        <td style="background: url(themes/Woody-ZONE/images/buttoncenter.gif);">
                                                <a href="{SEARCH_TGT}" title="{SEARCH_LNK}">{SEARCH_LNK}</a>
                                        </td>
                                        <td><img name="buttonright1" src="themes/Woody-ZONE/images/buttonright1.gif" width="7" height="25" border="0" alt="" /></td>
                                </tr>
                        </table>

EOT;

// HTML template for gallery admin menu
$template_gallery_admin_menu = <<<EOT

                <div align="center">
                <table cellpadding="0" cellspacing="1">
                        <tr>
<!-- BEGIN admin_approval -->
                                <td class="admin_menu" id="admin_menu_anim"><a href="editpics.php?mode=upload_approval" title="{UPL_APP_TITLE}">{UPL_APP_LNK}</a></td>
<!-- END admin_approval -->
                                <td class="admin_menu"><a href="admin.php" title="{ADMIN_TITLE}">{ADMIN_LNK}</a></td>
                                <td class="admin_menu"><a href="catmgr.php" title="{CATEGORIES_TITLE}">{CATEGORIES_LNK}</a></td>
                                <td class="admin_menu"><a href="albmgr.php{CATL}" title="{ALBUMS_TITLE}">{ALBUMS_LNK}</a></td>
                                <td class="admin_menu"><a href="groupmgr.php" title="{GROUPS_TITLE}">{GROUPS_LNK}</a></td>
                                <td class="admin_menu"><a href="usermgr.php" title="{USERS_TITLE}">{USERS_LNK}</a></td>
                                <td class="admin_menu"><a href="banning.php" title="{BAN_TITLE}">{BAN_LNK}</a></td>
                                <td class="admin_menu"><a href="reviewcom.php" title="{COMMENTS_TITLE}">{COMMENTS_LNK}</a></td>
                                </tr><tr>
<!-- BEGIN log_ecards -->
                                <td class="admin_menu"><a href="db_ecard.php" title="{DB_ECARD_TITLE}">{DB_ECARD_LNK}</a></td>
<!-- END log_ecards -->
                                <td class="admin_menu"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_LNK}</a></td>
                                <td class="admin_menu"><a href="searchnew.php" title="{SEARCHNEW_TITLE}">{SEARCHNEW_LNK}</a></td>
                                <td class="admin_menu"><a href="util.php" title="{UTIL_TITLE}">{UTIL_LNK}</a></td>
                                <td class="admin_menu"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a></td>
<!-- BEGIN documentation -->
                                <td class="admin_menu"><a href="{DOCUMENTATION_HREF}" title="{DOCUMENTATION_TITLE}" target="cpg_documentation">{DOCUMENTATION_LNK}</a></td>
<!-- END documentation -->
                        </tr>
                </table>
                </div>
EOT;



?>

Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: sevencreations on May 31, 2010, 04:49:40 am
I dont know what i have done wrong in the code but  i get this erorr after trying

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /mounted-storage/home139/sub014/sc75725-AETA/lak/themes/Woody-ZONE/theme.php  on line 107


but above is the file without my edited / mod theme.php so if someone can correct my above theme.php as needed and give me i can try it again please help !!
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: Joachim Müller on May 31, 2010, 08:50:43 am
Start a thread of your own on the support board doing as suggested per board rules.
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: realz on February 11, 2011, 04:28:59 am
if after upload .youtube video you want to display youtube thumbnails,

change:
includes/functions.inc.php

search for (near line 1697):
Code: [Select]
$thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
replace for:
Code: [Select]
if(!str_replace(".youtube","",$row['filename'])){
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
} else {
$thumb_list[$i]['image'] = "<img src=\"http://img.youtube.com/vi/".str_replace(".youtube","",$row['filename'])."/2.jpg\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
//http://img.youtube.com/vi/8kRQlCt9LBk/2.jpg
}


Done!
Title: Re: Displaying videos from Youtube in Coppermine without fopen & Youtube dev API ID
Post by: realz on February 11, 2011, 04:48:38 am
to automate a thumb create,

create:
/albums/youtube/

create:
/youtube.php

on youtube.php, the code: (change YOURID for your user on youtube)
Code: [Select]
$xml = "";
$f = fopen( 'http://gdata.youtube.com/feeds/api/users/[b]YOURID[/b]/uploads', 'r' );

while( $data = fread( $f, 4096 ) ) {
$xml .= $data;
}
fclose( $f );

preg_match_all( "/\<entry\>(.*?)\<\/entry\>/s", $xml, $bookblocks );
$i = 0;
foreach( $bookblocks[1] as $block ){

preg_match_all( "/\<id\>(.*?)\<\/id\>/",    $block, $id );

if(!file_exists("albums/youtube/".end(explode("/",$id[1][0])).".youtube")){
$log = end(explode("/",$id[1][0]));
$file = fopen("albums/youtube/".end(explode("/",$id[1][0])).".youtube","a+");
fwrite($file,$log);
fclose($file);
echo '0';
}

}

after this, just add the ".youtube videos" on admin