forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Permissions & Access Rights => Topic started by: cyw16 on July 05, 2004, 11:11:22 am

Title: Disallow unregistered to see original size
Post by: cyw16 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!
Title: Re: Disallow unregistered to see original size
Post by: Joachim Müller 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
Title: Re: Disallow unregistered to see original size
Post by: cyw16 on July 07, 2004, 07:45:33 am
Thanks! It works just the way I want to to now.   :D
Title: Re: Disallow unregistered to see original size
Post by: another_angel 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~
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: Joachim Müller 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
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: another_angel 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~
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: Casper 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";
}
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: another_angel on July 13, 2004, 01:22:57 am
Thank you!!  This worked perfectly.   ;)
~A~
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: Joachim Müller 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
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: xplicit 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
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: rostros on September 17, 2004, 03:11:36 pm
Any chance of this mod working for thumbnails ?
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: Joachim Müller 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
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: M3 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)?
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: Joachim Müller on September 22, 2004, 09:47:23 pm
sure, add some "if" clauses to the code.

Joachim
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: ks 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
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: kegobeer 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.
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: Tranz 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.
Title: Re: [Solved]: Disallow unregistered to see original size
Post by: ks 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
Title: Re: Disallow unregistered to see original size
Post by: turtleboy on October 20, 2004, 03:01:38 pm
Just installed this mod, works great with cpg132.
Title: Re: Disallow unregistered to see original size
Post by: Keanuette 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.
Title: Re: Disallow unregistered to see original size
Post by: Keanuette on October 24, 2004, 01:22:51 pm
ok, just read the previous thread and added that extra bit. Thanks anyho.  ;D
Title: Re: Disallow unregistered to see original size
Post by: Coyote on December 20, 2004, 10:18:00 pm
This is great - but Is it possible to validate the usergroup with code similar to above? Im using the smf bridge (non api version)

I just want the above code to work for users in the group 'Newbie'. But I cant find how to validate it :(

Any ideas appreciated.

Thanks,

Tony,
Title: Re: Disallow unregistered to see original size
Post by: legend_neo on January 16, 2005, 10:24:53 pm
hi .. i searched but cant find which mod u r talking about ...  or which php file that u r refering  ..

so in a simple way  ... if i ch mod full size images using ftp client like "cute ftp" and ch mood them to "660"  ... will it work ???

please explain me ... will it just prevent ppl from linking to the pic .. i mean the pic will be displayed on the gallery  ... aor it has any other effect as well .....
Title: Re: Disallow unregistered to see original size
Post by: Ronski on June 27, 2005, 02:05:47 pm
been trying to figure out how to do this, great thread thanks for all the code posts everyone!

Cheers,
Kieron
Title: Re: Disallow unregistered to see original size
Post by: LilAngel on December 06, 2005, 07:12:56 pm
I had this small hack on 1.3, and I would really like to use it again. I don't want to use the disable guest access function, cause I do allow people to browse the gallery.. just not see the HQs.
Title: Re: Disallow unregistered to see original size
Post by: Xandrios on December 07, 2005, 08:06:39 pm
For the new 1.4.2 version of the gallery it works a bit different. You need to edit include/themes.inc.php, this is how it works:

find:
Quote
            $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";
         

and replace that with:
Quote
            if(USER_ID) {
            $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_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']}\" onclick=\"alert('Please login to see the full size picture.')\"/><br />";      
         }

You can leave out the Alert-part if you want, but its a nice way to makes things clear for your visitors.
Title: Re: Disallow unregistered to see original size
Post by: Paver on January 19, 2006, 02:50:51 am
This it the wrong place to discuss the 1.4 version but since you did, let me say that you should *never* edit themes.inc.php.  Instead, copy the code you need from the sample theme's theme.php file into your theme's theme.php and modify at will.  The variables & functions in the sample theme show you all the display-related things you can modify without touching the core Coppermine code.

Another way in version 1.4 to do what this thread discusses is to use my plugin:
http://forum.coppermine-gallery.net/index.php?topic=25010.0 (http://forum.coppermine-gallery.net/index.php?topic=25010.0).