Disallow unregistered to see original size Disallow unregistered to see original size
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Disallow unregistered to see original size

Started by cyw16, July 05, 2004, 11:11:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cyw16

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!

Joachim Müller

edit displayimage.php, find            $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            //$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

cyw16

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

another_angel

Quote from: GauGau on July 06, 2004, 08:48:50 AMor 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~

Joachim Müller

to check wether a user is logged in or not, use this statement:if (!USER_ID)

GauGau

another_angel

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~

Casper

Open displayimage.php, and find;

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;

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";
}
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


Joachim Müller

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

xplicit

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:

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:

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 :

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
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


Joachim Müller

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

M3

Quote from: rostros on September 17, 2004, 03:11:36 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)?

Joachim Müller


ks

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

kegobeer

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.
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


ks

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


Keanuette

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.