External Viewer Plugin External Viewer Plugin
 

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

External Viewer Plugin

Started by Enterfrize, November 08, 2008, 01:31:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Enterfrize

Hi Guys!

I've been searching these forums to no avail.  Maybe I'm not looking for the right thing.

Here is our gallery: http://www.mtbs3d.com/gallery

I'm looking for a plug-in that will let members right-click on a picture, and choose a viewer of their choice.  In our case, we need a means for them to open up special S-3D viewing software.

It would be great if they could just double-click on a picture, and have the image open in their default JPG viewer instead of Coppermine.

We are running gallery 1.4.13.

Any ideas?

Regards,
Enterfrize

Enterfrize

Actually, maybe the word "player" is more appropriate?

I don't want the image to be seen inside the coppermine page.  I want it to open a completely external program altogether.

Regards,
Enterfrize

Joachim Müller

Quote from: Enterfrize on November 08, 2008, 01:31:49 AM
I'm looking for a plug-in that will let members right-click on a picture, and choose a viewer of their choice.  In our case, we need a means for them to open up special S-3D viewing software.
Such a plugin doesn't exist as far as I know, at least none that I'm aware of. You can add more players to your theme though if they player software can be downloaded and registers properly with the browser. In fact, you edit theme.php, find$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" ',
                               );
and add your player after that. If the section I refered to doesn't exist in your custom theme, copy// 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);
}
from themes/sample/theme.php first, then edit as I suggested.
You have to understand how this works in the first place: the output created by coppermine instructs the browser to use a particular player if it exists on the client's machine if that player is available. If such a player isn't available, the browser should prompt the user to install to needed player plugin. Into this process, coppermine is not really envolved. As you failed to point out what file extension / mime type or player software your "special S-3D viewing software" has, I can't advice more. Post details if you need details.

Quote from: Enterfrize on November 08, 2008, 01:31:49 AMWe are running gallery 1.4.13.
Yikes. Before doing anything else, it's absolutely mandatory to upgrade to the most recent release (currently cpg1.4.19). You're in great danger of being hacked if you don't upgrade - it's rather likely in fact that you already have been hacked! Panic? Yes, it's time to panic, with such an ancient version on your page.

As there is no such plugin available that will do what you're up to, but there is the option to apply changes to your template, I'm moving this thread from the plugins board to the board that deals with theme/template customizations.

Enterfrize

Yeash!  We'll get that taken care of.

SVIEW is a picture viewer.  Stereoscopic 3D photos are just JPG images, but they are in a side by side format.  So, while a 2D photo can be 1024X768, a 3D photo will be 2048X768.

Here is a link to the program:

http://iz3d.com/t-dcplayer.aspx

Normally, a 3D image is in .JPS format (it's just .JPG renamed to .JPS) so the correct viewer is activated.  However, the gallery won't let us preview .JPS images because it doesn't recognize them as JPG for some reason, so no thumbnails will be shown.

Any ideas?

Regards,
Enterfrize

Fabricio Ferrero

Try adding 'JPS' to the allowed file format in confing panel. AFAIK GD support JPS just fine.
Read Docs and Search the Forum before posting. - Soporte en español
--*--
Fabricio Ferrero's Website

Catching up! :)

Enterfrize

We did.  What happens is you can upload JPS images no problem.  However, they are not viewable as thumbnails in the gallery.  Like, the program doesn't know what to do with them.

Thanks for your continued help.

Regards,
Enterfrize

Fabricio Ferrero

Ok, so, I was wrong, GD can't handle JPS...   :-\

I just checked ImageMagick formats and seems can't handle either. Wait till another supporter reply and lead you to the answer.  ;)
Read Docs and Search the Forum before posting. - Soporte en español
--*--
Fabricio Ferrero's Website

Catching up! :)

Enterfrize

Well, even if it's just JPG - that's fine.

I would be happy if there was a solution where people could right-click on a picture, and there is an option to view it with their favorite viewing software.  Is this possible through a Java applet?

Regards,
Enterfrize

Joachim Müller

The context menu fires up triggered by the browser, not by coppermine. However, what would be the use of a right-click gimmick that nobody is aware of? Even if you tell users with some text that they need to right-click, that would not be an elegant solution. There are two things that you have to take care of: the upload needs to work as expected, and you need to make sure that the browser plugin fires up if installed within the user's browser. A workaround would be to rename the stereoscopic images to jpg, upload them and later rename them back to "jps". To make this an automatic process, you'd need to hack a lot of the code.
Using Java is not an option imo - you'd need a Java application written for you. JavaScript is in theory capable of modifying the code executed on right click, so you could come up with a context menu created with JavaScript, but that would be no further help - a straightforward link underneath the image that you could click on would do just the same. You'll have to take care of the initial issues first: make the upload work in the first place. Then make sure you get the player (browser plugin) working, triggered by the mime type.

Enterfrize

Hi Guys!

I found the solution!  I found the solution!

I've written a special guide here:

http://www.mtbs3d.com/cgi-bin/newsletter.cgi?news_id=61

The only caveat is to view a full sized image, you need to open it by clicking on the thumbnail because the URL itself is javascript.  It would be better if the thumbnail URL was a link to the actual full sized image instead.

However, I think this guide will be very helpful to anyone looking for a way to make their images instantly viewable by an external picture viewer.

Regards,
Enterfrize