Advanced search  

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]

Pages: 1 ... 3 4 5 6 [7]   Go Down

Author Topic: Prevent downloading of pics - transparent gif overlay  (Read 149635 times)

0 Members and 1 Guest are viewing this topic.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Prevent downloading of pics - transparent gif overlay
« Reply #120 on: February 26, 2009, 09:07:53 am »

Then undo and apply exactly as suggested. The message you got is simply a syntax error and shows that you haven't followed instructions to a tee.
Logged

Aurra

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 22
Re: Prevent downloading of pics - transparent gif overlay
« Reply #121 on: March 17, 2009, 10:45:56 pm »

I have still a problem with it.
The normal and full size fotos are not shown.
There is only a white square with a black dot/square in the middle.

i use a changed water_drop theme.
You can find it here http://www.kromfohrlaender-fotos.de
Now i use the normale theme.php again.

It would be nice to have a litte chance to prefent newbs from right clicking...

Here is the theme.php with the change:

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2007 Coppermine Dev Team
  v1.1 originally 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.12
  $Source$
  $Revision: 3636 $
  $Author: gaugau $
  $Date: 2007-06-29 11:35:30 +0200 (Fr, 29 Jun 2007) $
**********************************************/

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 template sys_menu spacer
$template_sys_menu_spacer ='<img src="themes/water_drop/images/orange_carret.gif" width="23" height="12" border="0" alt="" />';

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']) > 4array_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']==|| $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'])) {
$imginfo=getimagesize($picture_url);
            
$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 "<table cellpadding=0 cellspacing=0><tr><td background=\"" $picture_url "\" width={$imginfo[0]} height={$imginfo[1]} class=\"image\">";
            
$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=\"images/overlay.gif\" width={$imginfo[0]} height={$imginfo[1]}  border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
            
$pic_html .= "</a>\n </td></tr></table>";
        } else {
$pic_html "<table cellpadding=0 cellspacing=0><tr><td background=\"" $picture_url "\" width={$CURRENT_PIC_DATA['pwidth']} height={$CURRENT_PIC_DATA['pheight']} class=\"image\">";
            
$pic_html .= "<img src=\"images/overlay.gif\" width={$CURRENT_PIC_DATA['pwidth']} height={$CURRENT_PIC_DATA['pheight']} border=\"0\" alt=\"\" /><br />\n";
            
$pic_html .= "</td></tr></table>";
}
    } 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['classid'].$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_display_fullsize_pic()
{
    global 
$CONFIG$THEME_DIR$ALBUM_SET;
    global 
$lang_errors$lang_fullsize_popup$lang_charset;

    if (isset(
$_GET['picfile']))
    {
        if (!
GALLERY_ADMIN_MODEcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);

    
$picfile $_GET['picfile'];
    
$picname $CONFIG['fullpath'] . $picfile;
    
$imagesize = @getimagesize($picname);
    
$imagedata = array('name' => $picfile'path' => path2url($picname), 'geometry' => $imagesize[3]);
    }
    elseif (isset(
$_GET['pid']))
    {
    
$pid = (int)$_GET['pid'];
    
$sql "SELECT * " "FROM {$CONFIG['TABLE_PICTURES']} " "WHERE pid='$pid$ALBUM_SET";
    
$result cpg_db_query($sql);

    if (!
mysql_num_rows($result)) cpg_die(ERROR$lang_errors['non_exist_ap'], __FILE____LINE__);

    
$row mysql_fetch_array($result);
    
$pic_url get_pic_url($row'fullsize');
    
$geom 'width="' $row['pwidth'] . '" height="' $row['pheight'] . '"';
    
$imagedata = array('name' => $row['filename'], 'path' => $pic_url'geometry' => $geom);
    }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
  <title><?php echo $CONFIG['gallery_name'?>: <?php echo $lang_fullsize_popup['click_to_close'];
      
?>
</title>
  <script type="text/javascript" src="scripts.js"></script>
  <style type="text/css">
  body { margin: 0; padding: 0; background-color: gray; }
  img { margin:0; padding:0; border:0; }
  #content { margin:0 auto; padding:0; border:0; }
  table { border:0; <?php $imagedata['geometry'?> border-collapse:collapse}
  td {         vertical-align: middle; text-align:center; }
  </style>
  </head>
  <body>
    <script language="JavaScript" type="text/JavaScript">
      adjust_popup();
    </script>
    <table cellpadding="0" cellspacing="0" align="center">
      <tr>
              <?php     
   echo "<td align=\"center\" valign=\"middle\" background=\"" htmlspecialchars($imagedata['path']) . "\" {$imagedata['geometry']} class=\"image\">";
echo "<div id=\"content\">";
   echo  '<a href="javascript: window.close()"><img src="images/overlay.gif" '
                
$imagedata['geometry']
                . 
' alt="'
                
htmlspecialchars($imagedata['name'])
                . 
'" title="'
                
htmlspecialchars($imagedata['name'])
                . 
"\n" $lang_fullsize_popup['click_to_close']
                . 
'" /></a><br />' ."\n";
               
?>

          </div>
        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}

?>

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Prevent downloading of pics - transparent gif overlay
« Reply #122 on: March 18, 2009, 09:13:08 am »

It would be nice to have a litte chance to prefent newbs from right clicking...
Then use http://forum.coppermine-gallery.net/index.php/topic,33377.0.html
Logged

Aurra

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 22
Re: Prevent downloading of pics - transparent gif overlay
« Reply #123 on: March 22, 2009, 12:37:45 pm »

Hallo Joachim,

thank you very much for the fast reply!
That's a great plugin and exactly what my father wants for his site.
That will be stopping the one photo thief for sure.  Okay print SCRN will always working, but for some thausand of photos that's to much work... ;)
I hope the RC Option in 1.5 will be something like that.

Thanks!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Prevent downloading of pics - transparent gif overlay
« Reply #124 on: March 23, 2009, 10:24:51 am »

Hate to spoil the fun for you, but turning JavaScript off will do the trick as well for the thief. In fact, the thief can do a million other things to circumvent the no-right-click script and no doubt will. However, your posting doesn't belong in this thread, but in the other thread that I refered to: you talk about the right-click-prevention plugin inside the announcement thread of an unrelated mod. That's not a clever thing to do, so please respect common sense: if you have something to say about the no-right-click-plugin, do so on the proper thread.
Logged

Radek7

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Prevent downloading of pics - transparent gif overlay
« Reply #125 on: April 01, 2009, 05:17:47 am »

Hi,
  I am using your overlayhack and I just found little problem. If there is %20 in original image path, original image doesn't appear. I also use MassImport plug-in for creating categories and albums.
Is it limitation of hack or html code? And is there any way to modify this hack to work with %20 in file name?

                  Radek
Logged

Radek7

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Prevent downloading of pics - transparent gif overlay
« Reply #126 on: April 01, 2009, 04:20:52 pm »

Hi,
  I just checked Auraa's website http://www.kromfohrlaender-fotos.de and his problem is also because '%20'. I his case in file names.

             Radek
Logged

Nibbler

  • Guest
Re: Prevent downloading of pics - transparent gif overlay
« Reply #127 on: April 01, 2009, 04:53:53 pm »

Read the thread. The solution has already been posted, twice in fact.
Logged

Radek7

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Prevent downloading of pics - transparent gif overlay
« Reply #128 on: April 03, 2009, 02:41:07 am »

Thanks for note, I reread everything once more and found solution.

                Radek
Logged

Ann665

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Prevent downloading of pics - transparent gif overlay
« Reply #129 on: April 17, 2009, 05:34:17 pm »

thanks  getting closer :)
Logged

olousek

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 8
    • PhotoWatches.eu
Re: Prevent downloading of pics - transparent gif overlay
« Reply #130 on: January 28, 2010, 10:48:34 pm »

of course possible. Basically you compare the modified functions with the original ones. Copy the changes into the original function and pack them in a if/ else clause
if (!USER_ID){...}  //for the not logged in user

Hello, I'm newbie in PHP - I need to know how to include this change...

Thanks!
Logged

GrubbyGirl

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Prevent downloading of pics - transparent gif overlay
« Reply #131 on: January 28, 2010, 11:55:08 pm »

Hi
I have tried this mod on the classic theme and it works a treat, however the theme I use on my gallery is chaoticsoul which already has the function theme_html_picture and function theme_display_fullsize_pic.  I would appreciate knowing if this mod can be applied to this template?  If so how can I do it?

My gallery is www.laurelhollomanonline.com/gallery  and I have attached the theme.php

I am a real newbie, but I am pretty good at following instructions  ;D

I hope you can help.

Thanks

Angela
Logged

olousek

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 8
    • PhotoWatches.eu
Re: Prevent downloading of pics - transparent gif overlay
« Reply #132 on: January 31, 2010, 03:55:13 pm »

Hello, Angela,

thank you!

I change my black_widdow theme by Stramm's instructions. And it works fine - for all visitors include ADMIN.

But I need to admin and defined groups can link and download photos.

I tried to make changes in accordance with your theme, but it doesn't work at all :-(

I attach theme.zip with Stramm's functions and theme1.zip with yours functions.

Is there anybody who can help me?

Thanks!

my gallery: http://www.PhotoWatches.eu
Logged

GrubbyGirl

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Prevent downloading of pics - transparent gif overlay
« Reply #133 on: January 31, 2010, 04:06:10 pm »

I have actually changed my theme (modified foliage theme) and I did have one problem with some pictures not displying the intermediate and large size, but found a solution on this thread.  I like the chaotic soul theme so if this mod could be made to work with it, that would be wonderful!

Angela
Logged
Pages: 1 ... 3 4 5 6 [7]   Go Up
 

Page created in 0.129 seconds with 19 queries.