coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: AvrilBoi on May 23, 2007, 11:53:49 PM

Title: Allow hotlinking for thumbnails?
Post by: AvrilBoi on May 23, 2007, 11:53:49 PM
Hi!
I have put a .htaccess file in my /albums/ folder, to prevent hotlinking.
This is the code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?allowed_site_1.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?allowed_site_2.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?allowed_site_3.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|bmp)$ http://www.alternative_server.com/hotlink.gif [NC,R,L]

Is there any way to allow people to hotlink thumbnails? My thumbnails are named by coppermine default: "thumb_filename.jpg"
Thanks
Title: Re: Allow hotlinking for thumbnails?
Post by: Tranz on May 24, 2007, 07:07:45 AM
It doesn't seem possible unless you use a different file extension for thumbs. For example, if you use .jpeg for thumbnails and erase jpeg from the list of protected files types.

This would require making changes to the Coppermine code, so I wouldn't really recommend it. Perhaps someone could propose a better idea.
Title: Re: Allow hotlinking for thumbnails?
Post by: Joachim Müller on May 24, 2007, 08:30:36 AM
There's no easy solution: you either allow hotlinking or you disallow it. You can't come up with a determination that hotlinking of thumbs is allowed, but intermediate/fullsize hotlinking is forbidden.
As Thu suggested: it would require extreme hacking to accomplish this.
Title: Re: Allow hotlinking for thumbnails?
Post by: AvrilBoi on May 26, 2007, 03:25:47 PM
Ok thanks...
I've asked that because I've read something like this
RewriteCond %{REQUEST_FILENAME} !(.*thumb|.*highlight) [NC]
somewhere else so I thought that would be possible.
Title: Re: Allow hotlinking for thumbnails?
Post by: AvrilBoi on May 26, 2007, 03:31:12 PM
Sorry for this double post, but I just figured out that that code works!
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !(.*thumb|.*highlight) [NC]
RewriteCond %{HTTP_REFERER} !^$
etc. etc.
Title: Re: Allow hotlinking for thumbnails?
Post by: Tranz on May 26, 2007, 04:44:27 PM
Interesting. Thanks for coming back and posting the solution.