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

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.

just_some_guy

ok thankyou, i will do that after i have a solution to the prob with the moderator.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

just_some_guy

ok...so i open up theme.php (classic theme) and paste this code: (GauGau posted this earlier ( the one from the link): // Displays a picture
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:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
                                'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
                                '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);
}


Then i do the last step of the tutorial and the finished theme.php code would look like this?

code:

// Displays a picture
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 (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'])) {


            $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:6BF52A52-394A-11d3-B153-00C04F79FAA6" ',
                                'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
                                '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);
}



Correct? sorry i am being a bit over cautious. Last time i attepted this mod i had big problems getting it to work again.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

pelhrimak

I have make mini tool.

If you want to download youtube video, use my upgrade.

theme.php find
</embed></object><br />';

replace it
Quote</embed></object><br /><a href="http://videodownloader.net/get/?url=http://youtube.com/watch?v=';. $vid . '"><img src="http://javimoya.com/blog/vd/botdl.gif"></a>';

DEMO:

http://videoklipy.zabava-portal.eu/displayimage.php?album=38&pos=0#nav_pic

Nibbler

[youtube.com] Error: Not a valid URL (http://youtube.com/watch?v=g50vzZzAja0). Visit our web to know in detail what video sites are supported.

Nice.

pelhrimak

Tomorrow it worked, I think, that their server is busy.

:)

Joachim Müller

[sarcasm]
Sure. Youtube must be to blame, they are known to have weak servers and to change their API constantly. It's impossible that there is someting wrong with your code.
[/sarcasm]

::)

pelhrimak

#2 :)

If you want to download youtube video, use my upgrade.

theme.php find
</embed></object><br />';

replace it
</embed></object><br /><a href="http://cache.googlevideo.com/get_video?video_id='. $vid . '">Download it!</a>
DEMO:

http://videoklipy.zabava-portal.eu/displayimage.php?album=38&pos=0#nav_pic
[/quote]

bpw

i'm making a video section for my site and i want to add youtube videos eveytime i try to upload a youtube video i get

0 uploads were successful.

i already read and did everything from: http://forum.coppermine-gallery.net/index.php?topic=37962.0
and i'm still not getting it

the url to my site is http://bradpittweb.com/video/

Nibbler

It would help if you provide a way for us to test it...

phill104

Nibbler,

The demo site you list on your thread opener is no longer valid. Do you have an alternative you could change it to?

I would like to do this mod but would like to see it working first
It is a mistake to think you can solve any major problems just with potatoes.

Nibbler

Link updated, but you'd be better off reviewing links posted in this thread by others to see the original mod.

phill104

Thanks Nibbler. That theme you use in that site is fantastic by the way, you really are quite good at this stuff.

I integrated this mod just now and it works really well (once I installed it to the right coppermine install while viewing another :-[)

http://www.windsurf.me.uk/cpg133/thumbnails.php?album=34
It is a mistake to think you can solve any major problems just with potatoes.

ff

Sometime you don't want any related video's to be shown after your movie has finished.

Edit theme.php and find this line:

Quote
$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 />';

Replace with:

Quote
$pic_html = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/';. $vid . '&rel=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/';. $vid . '&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />';

The addition is &rel=0 after the movie-ID.
This comes from YouTube, so you can use it without fear ;)

PS. GREAT MOD

alanpalan

hi. i want to use this great looking mod to my coppermine gallery. but i must tu ask one stupid question - what exactly is Youtube API ID and how can i get it? i created Youtube developer account... but what next? how can i get the desired ID? :) thank you for answer :)

phill104

An API ID is a system many vendors use to keep a check on the usage and control the use of their APIs. With youtube you can see your code by clicking on the link below when you are logged on as a developer.

http://www.youtube.com/my_profile_dev
It is a mistake to think you can solve any major problems just with potatoes.

alanpalan

is it possible to send ecard (or mail to your friend) with specific youtube video in coppermine gallery?

Joachim Müller


dreams83

#157
A little something I made to pull series and such from youtube. it allow you to search and uplaod from youtube to your server by specifying title, author and such from youtube.

See Picture below

make a "youtube_search.php" file in the root of coppermine with the code below


<?php
/*
For use with: Displaying videos from Youtube in Coppermine
At http://forum.coppermine-gallery.net/index.php?topic=37962.0

This will use the youtube feed API to search and pull video from
youtube. You can either specify title, author, start index and max result
max result is 50. So use start index to get all the stuff you want from youtube.
It was usefully for me. I hope you find it usefull too

Toua or dreams83 :)

*/
define('IN_COPPERMINE'true);
define('LOGIN_PHP'true);

require(
'include/init.inc.php');
global 
$USER_DATA;

pageheader("YouTube Search");
starttable('100%'"Download from YouTube",2);//$lang_login_php['enter_login_pswd'], 2);
echo <<< EOT
<tr>
  <td class="tableb" >
      <table width="100%" cellspacing="2" cellpadding="2">
        <tr>
          <td>
EOT;

echo 
'
<form id="search_tube" name="search_tube" method="post" action="youtube_search.php">
Enter Search: <input name="q" id="q" type="text" size="50" maxlength="180" value="'
.$_REQUEST['q'].'" /><br/><br/>
Enter Author: <input name="art" id="art" type="text" size="50" maxlength="180" value="'
.$_REQUEST['art'].'" /><br/><br/>
Start Index: <input name="stid" id="stid" type="text" size="50" maxlength="180" value="'
.$_REQUEST['stid'].'" /><br/><br/>
Max Result: <input name="mrt" id="mrt" type="text" size="50" maxlength="180" value="'
.$_REQUEST['mrt'].'" /><br/><br/>
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
'
;
if((
$_REQUEST['q']!="" || $_REQUEST['art']!= "") && GALLERY_ADMIN_MODE ){
$after "";
if($_REQUEST['art']!= "" ){
$after .= "&author=".$_REQUEST['art'];
}
if( $_REQUEST['q']!= "" ){
$after .= '&vq='.$_REQUEST['q'];
}
if(is_numeric($_REQUEST['stid'])){
$after .= "&start-index=".$_REQUEST['stid'];
}
if(is_numeric($_REQUEST['mrt'])){
$after .= "&max-results=".$_REQUEST['mrt'];
}

echo '<h4>See The Search Result (These are the video you will upload to your Coppermine Gallery):</h4><a href="http://gdata.youtube.com/feeds/videos?orderby=updated'.$after.'" target="_blank"><h2>'.$after'</h2></a>';
$xurl "http://gdata.youtube.com/feeds/videos?orderby=updated".$after;
$xdata file_get_contents(str_replace(' ','+',$xurl));
echo '<textarea name="sds" cols="90" rows="20">'.$xdata.'</textarea><br/>';
preg_match_all('/http:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_\+\-\.]{11})/'$xdata$matches);

$alllist array_merge(array_unique($matches[0]));
//print_r($alllist);
if(sizeof($alllist)){

echo '
<script language="javascript" type="text/javascript">
function textCounter(field, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
}
</script>

<form method="post" action="upload.php" enctype="multipart/form-data">
<!-- Start standard table -->
<table align="center" width="100%" cellspacing="1" cellpadding="0" class="maintable">
<tr>
<td class="tableh1" colspan="2">Upload file</td>
</tr>
<tr><td colspan="2"><br />
  When you finished reviewing what you\'ll get above, please click \'Continue\'.</td></tr>        

<tr>
<td class="tableh2" colspan="2">
<b>Youtube uploads</b>
</td>
</tr>'
;

for($i=0;$i<sizeof($alllist);$i++){
echo '<tr>
<td width="40%" class="tableb">
  '
.($i+1).'. 
</td>
<td width="60%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="YT_array[]" maxlength="256" value="'
.$alllist[$i].'" class="textinput" id="YT_array[]" />
</td>
</tr>'
;
}
echo '<tr>
<td class="tableh2" colspan="2">
<b>Note: YouTube videos must be added in the form http://www.youtube.com/watch?v=xxxxxxxxxxx</b>
</td>
</tr>
<tr>
<td colspan="2">

   <input type="hidden" name="control" value="phase_1" />
</td>
</tr>
<tr>
<td colspan="2" align="center" class="tablef">
<input type="submit" value="CONTINUE" class="button" />
</td>

</tr>

</table>
<!-- End standard table -->
</form>'
;

}
}
echo <<< EOT
</td>
        </tr>
      </table>
   </td>
</tr>
EOT;
endtable();
pagefooter();
ob_end_flush();
?>



maybe someone can help me check:

preg_match_all('/http:\/\/www\.youtube\.com\/watch\?v=([a-zA-Z0-9_\+\-\.]{11})/', $xdata, $matches);

to see if it is correct. not good with regular expressions. I just want to get all the "http://www.youtube.com/watch?v=xxxxxxxxxxx" links. But I am not good at it so I got that to work but maybe someone can fix it to make it better.

elvisq

http://forum.coppermine-gallery.net/index.php?topic=37962.0

non c'è una guida in italiano???


grazie

o qualcuno che abbia voglia di spiegarlo passo passo...

grazie

elvis

Joachim Müller

In this thread (and all other boards outside of the language-specific support boards) only English is permitted. If you don't speak English, post your question on the Italian sub-board, with a reference to this thread. Maybe Lontano (the moderator of the Italian support board) will be able to help you.