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

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.

bas123

What about other video providers?

Metacafe, Google etc. - There are many I know, but is there a code fix that would enable additional outside providers?

Also, before integrating this feature, I wish to confirm that:
1) This will allow registered members (as well as Admins) to upload videos from YouTube (or elsewhere if coded) in the same interface as images.
   A) There are some sort of instructions built in (or do we need to code them in any way)
2) What about Coppermine upgrades?
   A) Will future versions of Coppermine have this built in, or will we need to start over?

Thanks  :)

phill104

Quote from: bas123 on June 11, 2008, 06:44:59 PM
What about other video providers?

Metacafe, Google etc. - There are many I know, but is there a code fix that would enable additional outside providers?

Also, before integrating this feature, I wish to confirm that:
1) This will allow registered members (as well as Admins) to upload videos from YouTube (or elsewhere if coded) in the same interface as images.
   A) There are some sort of instructions built in (or do we need to code them in any way)
2) What about Coppermine upgrades?
   A) Will future versions of Coppermine have this built in, or will we need to start over?

Thanks  :)

You have broken about every rule associated to this forum you possibly can. Before posting you should read the rules you have agreed to when signing up for the forums such as hijacking a thread, asking more than one question in a thread, not bothering to read back through that thread for answers to some of your questions and not bothering with the search facility.

If you want people to help then try to do the basics for yourself and try and respect this boards policies.
It is a mistake to think you can solve any major problems just with potatoes.

mladja04

Do I can to use this great mod with good version (some of last version) of PHP 4?


Do exist some youtube mod for us who have PHP 4?
The best regards,
Mladen

LeaX

Quote from: phill104 on June 11, 2008, 07:30:55 PM
You have broken about every rule associated to this forum you possibly can. Before posting you should read the rules you have agreed to when signing up for the forums such as hijacking a thread, asking more than one question in a thread, not bothering to read back through that thread for answers to some of your questions and not bothering with the search facility.

If you want people to help then try to do the basics for yourself and try and respect this boards policies.
Yeah, but can you imagine how it's hard to read miles of technic texts you hardly understand even in native language when you're not native English-speaker....  >:(  >:(  >:(
If I could have an answer myself, I won't ask you(((

Nibbler

He's not talking to you. Pay attention to the use of quoting.

Quote from: LeaX on June 11, 2008, 09:52:53 AM
What is "theme_html_picture"? And how can I "apply" it? To what apply?

It's a function. You need to copy it from themes/sample/theme.php into your own theme.php and then make the code change described.

Quote from: bas123 on June 11, 2008, 06:44:59 PM
What about other video providers?

Metacafe, Google etc. - There are many I know, but is there a code fix that would enable additional outside providers?

Also, before integrating this feature, I wish to confirm that:
1) This will allow registered members (as well as Admins) to upload videos from YouTube (or elsewhere if coded) in the same interface as images.
   A) There are some sort of instructions built in (or do we need to code them in any way)
2) What about Coppermine upgrades?
   A) Will future versions of Coppermine have this built in, or will we need to start over?

Thanks  :)

This mod is coded for youtube, it is not designed to be a generic video mod.
It's easy to use, but add your own instructions. You can see where to do this fairly easily.
As with all mods to core code, you will need to reapply when you update. It can't easily be made into a plugin.

Quote from: mladja04 on June 11, 2008, 08:00:00 PM
Do I can to use this great mod with good version (some of last version) of PHP 4?

Should work fine with PHP4. If it doesn't then post what the problem is.

phill104

Quote from: LeaX on June 11, 2008, 08:45:04 PM
Yeah, but can you imagine how it's hard to read miles of technic texts you hardly understand even in native language when you're not native English-speaker....  >:(  >:(  >:(
If I could have an answer myself, I won't ask you(((

Appologies if it seems like it was directed at you, it was not. Also the post was not meant to come accross so grumpy ( I must be in a grumpy mood)

Attach your theme.php file (the one you are using for your theme) to your post and I will happilly copy accross the function you require. You will need to carry out the modification yourself (especially your youtube api key) but it will get you started.

Also be aware that there are forums in a number of languages on here where you might find it easier to ask your question.
It is a mistake to think you can solve any major problems just with potatoes.

dr_drewww

Hi great mod everything works except the youtube title and description.
In the original post regarding this mod it says that the title and description
is added. I have gone nearly cross eyed going through the replys to find if some one else
has this issue.
can anyone tell me why the title and description from youtube is not being displayed. and how to fix it  ;D


thanks

Nibbler

I haven't heard of anyone else with this issue. Did you test with several different youtube videos to make sure?

Post a link, test account with upload rights, and debug mode with notices enabled.

dr_drewww

Quote from: Nibbler on June 12, 2008, 11:10:11 PM
I haven't heard of anyone else with this issue. Did you test with several different youtube videos to make sure?

Post a link, test account with upload rights, and debug mode with notices enabled.

here is a link to the site http://www.halfmoonpub.co.uk/copper/thumbnails.php?album=3 I have now gone through and copy and pasted in the discriptions for the first four I tried. but i have uploaded a few more with the same result no title and description

thanks

bas123

Quote from: phill104 on June 11, 2008, 07:30:55 PM
You have broken about every rule associated to this forum you possibly can. Before posting you should read the rules you have agreed to when signing up for the forums such as hijacking a thread, asking more than one question in a thread, not bothering to read back through that thread for answers to some of your questions and not bothering with the search facility.

If you want people to help then try to do the basics for yourself and try and respect this boards policies.

I must say how much I enjoyed reading the subsequent posts to my question...   :o phill104's arrogant and misdirected reply suggesting that I hadn't searched the 14 pages of threads on the subject or elsewhere in this SMF forum. and suggestion that my question(s) were on more than one subject. Wow, perhaps you need to be designated as CP Sheriff.

THANK YOU Nibbler for your direct and responsive reply!

It's too bad that someone hasn't coded a plugin or other video system for displaying videos from multipe providers such as the mods for SMF, TinyPortal, Joomla, etc. etc. that do that!

Clearly, the interest in this forum regarding YouTube alone suggests one is dearly needed.

And to you LeaX - Thank you for your understanding... Obviously you too have experienced frustrations in attempting to get answers to honest questions.

phill104

#270
Quote from: dr_drewww on June 13, 2008, 12:23:02 AM
here is a link to the site http://www.halfmoonpub.co.uk/copper/thumbnails.php?album=3 I have now gone through and copy and pasted in the discriptions for the first four I tried. but i have uploaded a few more with the same result no title and description

thanks

Actually it doesn't automatically add the titles for me either. I have always added them myself manually with the description I wanted so I never realised that it should do anyway. You now have me scratching my head wondering why.

Do as Nibbler suggests and post a test account with upload rights, and debug mode with notices enabled so people on here can try and see what is going on.

I am also having problems viewing your site in IE but it is fine in Firefox and Safari.
It is a mistake to think you can solve any major problems just with potatoes.

bas123

Quote from: dr_drewww on June 13, 2008, 12:23:02 AM
here is a link to the site http://www.halfmoonpub.co.uk/copper/thumbnails.php?album=3 I have now gone through and copy and pasted in the discriptions for the first four I tried. but i have uploaded a few more with the same result no title and description

thanks
Integration issues aside, I just followed this link and clicked on three of the thumbnails.

Each crashed my browser..

Using IE 7 (screenshot attached)

jessemagano

How do I allow guest access to upload these youtube videos, right now only logged in users can upload youtube videos?


bas123

Regarding this part of the YouTube changes, I need some clarification please...

Quote from: Nibbler on October 31, 2006, 03:42:27 AM
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.

I am using the Valentine Theme, which apparently doesn't have that routine, so:
Quote(if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)

I located this in the the sample theme (from the original distribution), however, I cannot figure out how much of the code to copy from this file, or where in the active template theme.php to place it.

I tried pasting the following (including the YouTube change above):

// 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);
}

function theme_html_img_nav_menu()
{
    global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR ; //$PHP_SELF,
    global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;

    $cat_link = is_numeric($album) ? '' : '&amp;cat=' . $cat;
        $uid_link = is_numeric($_GET['uid']) ? '&amp;uid=' . $_GET['uid'] : '';

    $human_pos = $pos + 1;
    $page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols']));
    $pid = $CURRENT_PIC_DATA['pid'];

    $start = 0;
        $start_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$start";
        $start_title = $lang_img_nav_bar['go_album_start'];
        $meta_nav .= "<link rel=\"start\" href=\"$start_tgt\" title=\"$start_title\" />
        ";
        $end = $pic_count - 1;
        $end_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$end";
        $end_title = $lang_img_nav_bar['go_album_end'];
        $meta_nav .= "<link rel=\"last\" href=\"$end_tgt\" title=\"$end_title\" />
        ";

    if ($pos > 0) {
        $prev = $pos - 1;
        $prev_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$prev$uid_link";
        $prev_title = $lang_img_nav_bar['prev_title'];
                                $meta_nav .= "<link rel=\"prev\" href=\"$prev_tgt\" title=\"$prev_title\" />
                                ";
    } else {
        $prev_tgt = "javascript:;";
        $prev_title = "";
    }

    if ($pos < ($pic_count -1)) {
        $next = $pos + 1;
        $next_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pos=$next$uid_link";
        $next_title = $lang_img_nav_bar['next_title'];
                                $meta_nav .= "<link rel=\"next\" href=\"$next_tgt\" title=\"$next_title\"/>
                                ";
    } else {
        $next_tgt = "javascript:;";
        $next_title = "";
    }

    if (USER_CAN_SEND_ECARDS) {
        $ecard_tgt = "ecard.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
        $ecard_title = $lang_img_nav_bar['ecard_title'];
    } else {
        template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard
        /*$ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');";
        $ecard_title = $lang_img_nav_bar['ecard_disabled'];*/
    }

                //report to moderator buttons
    if (($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS)) {
        $report_tgt = "report_file.php?album=$album$cat_link&amp;pid=$pid&amp;pos=$pos";
    } else { // remove button if report toggle is off
        template_extract_block($template_img_navbar, 'report_file_button');

    }

                    $thumb_tgt = "thumbnails.php?album=$album$cat_link&amp;page=$page$uid_link";
        $meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']."\"/>
        ";

    $slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link$uid_link&amp;pid=$pid&amp;slideshow=".$CONFIG['slideshow_interval'];

    $pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);

    if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
            $location= $THEME_DIR;
        } else {
            $location= '';
        }

    $params = array('{THUMB_TGT}' => $thumb_tgt,
        '{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'],
        '{PIC_INFO_TITLE}' => $lang_img_nav_bar['pic_info_title'],
        '{SLIDESHOW_TGT}' => $slideshow_tgt,
        '{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
        '{PIC_POS}' => $pic_pos,
        '{ECARD_TGT}' => $ecard_tgt,
        '{ECARD_TITLE}' => $ecard_title,
        '{PREV_TGT}' => $prev_tgt,
        '{PREV_TITLE}' => $prev_title,
        '{NEXT_TGT}' => $next_tgt,
        '{NEXT_TITLE}' => $next_title,
        '{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',
        '{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',
        '{REPORT_TGT}' => $report_tgt,
        '{REPORT_TITLE}' => $lang_img_nav_bar['report_title'],
        '{LOCATION}' => $location,
        );

    return template_eval($template_img_navbar, $params);
}

function theme_html_rating_box()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR;
    global $template_image_rating, $lang_rate_pic;

    if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) return '';

    $votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round($CURRENT_PIC_DATA['pic_rating'] / 2000, 1), $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
    $pid = $CURRENT_PIC_DATA['pid'];

    if (defined('THEME_HAS_RATING_GRAPHICS')) {
        $location= $THEME_DIR;
    } else {
        $location= '';
    }

    $params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'],
        '{VOTES}' => $votes,
        '{RATE0}' => "ratepic.php?pic=$pid&amp;rate=0",
        '{RATE1}' => "ratepic.php?pic=$pid&amp;rate=1",
        '{RATE2}' => "ratepic.php?pic=$pid&amp;rate=2",
        '{RATE3}' => "ratepic.php?pic=$pid&amp;rate=3",
        '{RATE4}' => "ratepic.php?pic=$pid&amp;rate=4",
        '{RATE5}' => "ratepic.php?pic=$pid&amp;rate=5",
        '{RUBBISH}' => $lang_rate_pic['rubbish'],
        '{POOR}' => $lang_rate_pic['poor'],
        '{FAIR}' => $lang_rate_pic['fair'],
        '{GOOD}' => $lang_rate_pic['good'],
        '{EXCELLENT}' => $lang_rate_pic['excellent'],
        '{GREAT}' => $lang_rate_pic['great'],
        '{WIDTH}' => $CONFIG['picture_table_width'],
        '{LOCATION}' => $location,        //theme dir or default images directory
        );

    return template_eval($template_image_rating, $params);
}



and placed it just above

              //report to moderator buttons


I did this because this was where the next comment was...

but after testing, received a fatal error.

I reinstated the original theme.php (retaining the updated upload.php) and the fatal error goes away, so I know I've missed something in the theme file.

BTW, I have removed all theme files except the Valentine Theme. Is it advisable to have the default theme in place?

Have I copied too much?, too little?, placed it in the wrong place?

I am attaching theme.php as theme.txt for review if needed.

Thanks!

phill104

I haven't tried it as I am currently on a work PC but try using the attached theme.php in your valentines theme.
It is a mistake to think you can solve any major problems just with potatoes.

bas123

Quote from: phill104 on July 26, 2008, 10:41:12 PM
I haven't tried it as I am currently on a work PC but try using the attached theme.php in your valentines theme.

Thanks Phill104, That seemed to work, and I can navigate to a video I uploaded via the album's "next file" button, and it plays OK...

However when I click on the file's thumbnail, it crashes the page in IE7...

It works in FF 3.0 with the following warning:
QuoteWarning: Expected ':' but found '='.  Declaration dropped.
Source File: http://womenmotorcyclist.com/community/cpg1418/displayimage.php?album=1&pos=4#top_display_media
Line: 0

Any ideas?

bas123

Since last post, I've added several YouTube Videos successfully, so I am fairly confident that the upload.php is working OK,
Once we work out the theme.php issues, I'll probably add a more definitave explanation for the user about the YouTube URL regarding not including any text following the video code IE: "&feature=related" etc.

However, IE7 (at least) doesn't like the theme.php changes, as it crashes 85% +.

Is this common? or is it possible there's something missing or incorrect in the file theme.php from Phill104's zip?

I'd sure like to resolve this IE issue.

Also Phill104, just for my own edification, I am curious about where I may have gone wrong in intepretring the instructions relative to the theme.php.

I was unable to understand the instruction:
Quotetheme.php (if you can't find this code, copy theme_html_picture() over from sample theme and then apply the change)
and I'd bet others would appreciate a clarification as to where to copy from and where to end.

Nibbler

You copy the entire theme_html_picture() function - that's everything from the opening brace at the start of the function to the corresponding closing brace at the end of the function. That's about 160 lines of code. It doesn't matter where in the file you put it, so long as you don't stick it in the middle of something else.

bas123

Quote from: Nibbler on July 29, 2008, 11:08:18 AM
You copy the entire theme_html_picture() function - that's everything from the opening brace at the start of the function to the corresponding closing brace at the end of the function. That's about 160 lines of code. It doesn't matter where in the file you put it, so long as you don't stick it in the middle of something else.

Thanks Nibbler, I just feel embarrased but I'm still getting IE crashes...

I've followed the instructions for the theme mod.
I had originally added more code than that and got a php error, then I tried the file Phill104 provided which produced the crashes...

NOW
... here's what I added with the YouTube change (placed at end of file - before  "?>" )
// YouTube Modification

// 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);
}

// End YouTube Modification


No Change... MOST of the time, Whenever I click on any video's thumbnail... IE7 crashes and I get a message "Internet Explorer cannot open the page 'url_here' Operation aborted.

Notes: I have YouTube and many other videos from outside provider videos playing on my site... Coppermine is bridged into Joomla 1.5.3... I have removed all other templates from the themes folder except the Valentines Theme.

Full theme.php attached as a txt file - Please advise!