Announcement

#1 2009-05-03 20:37:24

sonreir
Member
2009-05-03
27

Prevent Hotlinking and Downloading ?

Hi,

first of all...this one is a great gallery !!
My question is, if it is possible to disable the downloading of pictures in the gallery. And i mean not only the "Download" icon, i mean also the "Save as" option when you right click a picture. Well in fact i tried the "norightclick" method, but didn't came far, because i got a blank page after clicking onto a picture in a category. So if this is the only possibility to prevent from downloading, could someone tell me where and which code exactly i have to put in to disable that? I mean it's not the "clean" version...but for the moment...

Another question is, how can i prevent hotlinking to the pictures? Let's assume my pics are in "/galleries/cat1/pic1.jpg. If you someone will hit the url : www.yourdomain.com/galleries/cat1/pic1.jpg he also will be able to see my pic and can use it. How can i prevent that?
I read some topics which says that you can use a .htaccess file. But where exactly do i put it in? In the main folder or the "galleries/cat1/ folder?

Thx for help in advance.

And for info...i got the 2.0.1. version. Is there maybe a Mod/Plugin for both my questions?

Regards,

Lucas

Offline

 

#2 2009-05-03 23:51:36

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Prevent Hotlinking and Downloading ?

by .htaccess
We can find some examples but there is a lot on Google.

I will come back on the download button later.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#3 2009-05-06 11:33:57

Jive Bunny
Member
2007-10-12
50

Re: Prevent Hotlinking and Downloading ?

sonreir wrote:

Hi,

first of all...this one is a great gallery !!
My question is, if it is possible to disable the downloading of pictures in the gallery. And i mean not only the "Download" icon, i mean also the "Save as" option when you right click a picture. Well in fact i tried the "norightclick" method, but didn't came far, because i got a blank page after clicking onto a picture in a category. So if this is the only possibility to prevent from downloading, could someone tell me where and which code exactly i have to put in to disable that? I mean it's not the "clean" version...but for the moment...

Another question is, how can i prevent hotlinking to the pictures? Let's assume my pics are in "/galleries/cat1/pic1.jpg. If you someone will hit the url : www.yourdomain.com/galleries/cat1/pic1.jpg he also will be able to see my pic and can use it. How can i prevent that?
I read some topics which says that you can use a .htaccess file. But where exactly do i put it in? In the main folder or the "galleries/cat1/ folder?

Thx for help in advance.

And for info...i got the 2.0.1. version. Is there maybe a Mod/Plugin for both my questions?

Regards,

Lucas

On right click scripts are a waste of time. It only serves to annoy genuine users. If they want an image then they can just go to their cache and get it. Its a waste of time, Imo. If it renders in the browser they can get it, period ;)

Now .htaccess wise you need to do this to stop other websites using the images. Place the .htaccess in the root of your domain. This will stop them using your images across your whole website.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.+)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)?www.yourdomain.com [NC]
RewriteCond %{REQUEST_URI} !^/images/dontsteal.gif [NC]
RewriteRule [^/]+.(gif|jpg|GIF|JPG|ico)$ http://www.yourdomain.com/images/dontsteal.gif [R,NC,L]

Remember to replace yourdomain with your actual domain.

Offline

 

#4 2009-05-06 14:30:14

sonreir
Member
2009-05-03
27

Re: Prevent Hotlinking and Downloading ?

Jive Bunny wrote:

On right click scripts are a waste of time. It only serves to annoy genuine users. If they want an image then they can just go to their cache and get it. Its a waste of time, Imo. If it renders in the browser they can get it, period ;)

Now .htaccess wise you need to do this to stop other websites using the images. Place the .htaccess in the root of your domain. This will stop them using your images across your whole website.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.+)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+)?www.yourdomain.com [NC]
RewriteCond %{REQUEST_URI} !^/images/dontsteal.gif [NC]
RewriteRule [^/]+.(gif|jpg|GIF|JPG|ico)$ http://www.yourdomain.com/images/dontsteal.gif [R,NC,L]

Remember to replace yourdomain with your actual domain.

Thx for that...works already for me. Well, i know that the solution with disabling right clicks is not the best one. The only thing i want to do is to prevent downloading pictures...that's all. And I'm open for all different possiblities.;)  There are some galleries where you can do that. If you want to download via "Right click" you get an empty file for download for each picture...or a *.php script. So in fact it is not annoying and the browser doesn't tell you that it is not allowed...you just download a fake/empty file for each picture you want to download. Does anyone know how to solve this?

Regards,

Lukas

Offline

 

#5 2009-05-06 17:03:21

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Prevent Hotlinking and Downloading ?

I didn't try this solution...
But it means coding <img src="...getpicture.php?id=xxx" or something thing like that
where getpicture.php should determine first the way it has been called.
Possible to do, anyway unuseful CPU consumption on server side for sure. I dislike this idea even if elegant solution it is.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#6 2009-05-08 15:53:48

Monsieur Dusnob
Member
2005-06-06
8

Re: Prevent Hotlinking and Downloading ?

The SecureImages plugin used to allow this in release 1.7.0 ; unfortunately it doesn't work with release 2.0.2 ...

Anyone to upgrade it ? ;)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact