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] 2   Go Down

Author Topic: Disallow unregistered to see original size  (Read 17441 times)

0 Members and 1 Guest are viewing this topic.

cyw16

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Disallow unregistered to see original size
« on: July 05, 2004, 11:11:22 am »

I would like to know if this is possible....

allow anyone to view thumbnails as well as albums (intermediate size), but at the same time remove the link for viewing the original size.  I know it may sound kind of silly, since I can delete the originals but I would rather keep the original files and have them viewable in the admin mode. As for registered folks, I don't mind if they are able to link to them or not.

Would it be using the if(!USER_ID) somewhere in the displayimage.php file? If it is (or not), I'm not sure what to edit. I'd appreciate any help I can get.

Thanks in advance!
« Last Edit: October 08, 2004, 09:06:28 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Disallow unregistered to see original size
« Reply #1 on: July 06, 2004, 08:48:50 am »

edit displayimage.php, find
Code: [Select]
            $pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,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";
and replace it with
Code: [Select]
            //$pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,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";
to get rid of the full-size link alltogether, or add your own logic by adding an if/then switch to show the full-size to registered users only.

GauGau
Logged

cyw16

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Disallow unregistered to see original size
« Reply #2 on: July 07, 2004, 07:45:33 am »

Thanks! It works just the way I want to to now.   :D
Logged

another_angel

  • Coppermine novice
  • *
  • Country: 00
  • Offline Offline
  • Posts: 28
    • Team Skarsgård
Re: Disallow unregistered to see original size
« Reply #3 on: July 12, 2004, 03:34:53 am »

or add your own logic by adding an if/then switch to show the full-size to registered users only.

This is what I want to do (allow only registered to see the full-size), but do not know how to write the if/then switch.  Can someone post the code I would need to add to displayimage.php to do this?
Thanks,
~A~
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: Disallow unregistered to see original size
« Reply #4 on: July 12, 2004, 09:06:12 am »

to check wether a user is logged in or not, use this statement:
Code: [Select]
if (!USER_ID)
GauGau
Logged

another_angel

  • Coppermine novice
  • *
  • Country: 00
  • Offline Offline
  • Posts: 28
    • Team Skarsgård
Re: [Solved]: Disallow unregistered to see original size
« Reply #5 on: July 12, 2004, 03:16:12 pm »

Can someone place the entire block of code that includes the if/then statement and the code that will turn on/off the link for registered/unregistered users?  Also, can you tell me where to actually put the code?  I'm not a programmer, just know enough to be dangerous.   ::)
Thanks,
~A~
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: [Solved]: Disallow unregistered to see original size
« Reply #6 on: July 12, 2004, 06:29:48 pm »

Open displayimage.php, and find;

Code: [Select]
if ($mime_content['content']=='image') {
        if (isset($image_size['reduced'])) {
            $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16;
            $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16;
            $pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,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";
       

Replace it with this code;

Code: [Select]
if ($mime_content['content']=='image') {
        if (isset($image_size['reduced'])) {
            $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16;
            $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16;
           
if (!USER_ID) {

//$pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,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 = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,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";
}
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

another_angel

  • Coppermine novice
  • *
  • Country: 00
  • Offline Offline
  • Posts: 28
    • Team Skarsgård
Re: [Solved]: Disallow unregistered to see original size
« Reply #7 on: July 13, 2004, 01:22:57 am »

Thank you!!  This worked perfectly.   ;)
~A~
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: Disallow unregistered to see original size
« Reply #8 on: July 13, 2004, 08:38:14 am »

it's a pity - I wanted to encourage you to find some things out for yourself, that's why I didn't post copy'n-paste-ready code. You're missing all the fun... ;)

GauGau
Logged

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: [Solved]: Disallow unregistered to see original size
« Reply #9 on: August 28, 2004, 11:21:00 pm »

First of all respect to the coppermine team!

I encourage what GAUGAU said finding your way trough coppermine is not always frustrating and can be fun too! Just giving source codes away is cool but just a blunt question without trying it yourself well..... :-\\

Allthough it can be hard sometimes, I wanted the same feature also and made it but Caspers code works perfec, you can even keep caspers code with a little modification for it. Based on Casper you can replace the first block which determines if a known user has logged in. Find in caspers code:

Code: [Select]
if (!USER_ID) {

//$pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=yes,status=yes,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";

}

and replace it by this little modification:

Code: [Select]
if (!USER_ID) {


$pic_html = "<a href=\"javascript:;\" onClick=\"MM_popupMsg('YOUR TEXT')\">";
                $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";

}

In your scripts.js add :

Code: [Select]
function MM_popupMsg(msg)

{ alert(msg);
}

By doing this unregistrated users who click the image will get a popup with YOUR TEXT for instance you can write please register to see full size or whatever you want.

Have fun with it

Xplicit
Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

rostros

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 49
Re: [Solved]: Disallow unregistered to see original size
« Reply #10 on: September 17, 2004, 03:11:36 pm »

Any chance of this mod working for thumbnails ?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: Disallow unregistered to see original size
« Reply #11 on: September 17, 2004, 10:53:12 pm »

sure, you're welcome to look into index.php and modify accordingly. See above posts - try doing thiss yourself, will give you more understanding how coppermine actually works.

Joachim
Logged

M3

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: [Solved]: Disallow unregistered to see original size
« Reply #12 on: September 22, 2004, 08:26:44 pm »

Any chance of this mod working for thumbnails ?

Is there any way to make this album specific? For example, blocking all thumbs and full images for non registered viewers, but allowing them to see thumbs in say, three galleries (to show it's worth signing up)?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [Solved]: Disallow unregistered to see original size
« Reply #13 on: September 22, 2004, 09:47:23 pm »

sure, add some "if" clauses to the code.

Joachim
Logged

ks

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 44
Re: [Solved]: Disallow unregistered to see original size
« Reply #14 on: October 07, 2004, 09:30:54 am »

nevertheless, a clever unregistered user will look at the pages source code and may figure out that the direct url to the image is ../mypic.jpg inszead of ../normal_mypic.jpg  or ../thumb_mypic.jpg :P :P :P

how can I work around this without restricting access to the whole gallery altogether via htaccess. Any suggestion is welcome!

klaus
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: [Solved]: Disallow unregistered to see original size
« Reply #15 on: October 07, 2004, 12:10:23 pm »

There's nothing you can do unless you password protect the directories.  If you don't want people looking at your pictures, the only thing you can do is keep them off the interent.  You can use htaccess to prevent hotlinking from another site, but if someone comes to your site and types the url to your image in the address bar, they'll see the image.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: [Solved]: Disallow unregistered to see original size
« Reply #16 on: October 07, 2004, 02:41:13 pm »

http://forum.coppermine-gallery.net/index.php?topic=3021.msg45672#msg45672
tells you how to redirect attempts to access images.
Logged

ks

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 44
Re: [Solved]: Disallow unregistered to see original size
« Reply #17 on: October 08, 2004, 08:57:59 am »

My php runs in safe mode so I can not use chmod directly. I finally found the following solution to secure the image files:
-A small php script that uses ftp access to chmod all fullsize images too 660. It works!
- I modified displayimage.php in a way, that for registered users the secured fullsize image is copied to a tempoary location via ftp. From there it can be accesed by the displayimage script.

So far it seems to work great but I willl test some more to make sure it is realy reliable.

klaus
Logged

turtleboy

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • SkylineDesigns
Re: Disallow unregistered to see original size
« Reply #18 on: October 20, 2004, 03:01:38 pm »

Just installed this mod, works great with cpg132.

Keanuette

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: Disallow unregistered to see original size
« Reply #19 on: October 24, 2004, 01:19:21 pm »

Hi

I've added this code but for some bizaarre reason, it's not working. Can someone please check for me.

http://keanua-z.com/gallery.

Many Thanks.
Logged
Pages: [1] 2   Go Up
 

Page created in 0.024 seconds with 19 queries.