There is an important post that received no answer on [Forum, post 126666 by plg in topic 18570] Multiple-size :
plg wrote:
This makes me think about an important point: hotlinking! If I hotlink a "web size" photo from my Piwigo 2.3 into a forum post, the hotlink must not be broken, and it must not show the original size instead (that would be very bad for the forum visitors and for the bandwidth of the gallery owner).
I think this issue is critical. We need a clean way to solve it for Piwigo upgrading from 2.3 to 2.4.
Offline
tricky one ... and difficult
The problem only arises for existing photos that have a pwg_high associated with them.
- for uploaded files with pwg_high, I suppose you could leave them in pwg_high and redirect non high towards xxx-la.jpg
- for FTP sync sites .... no idea ...
Offline
OK, we have a problem when the photo has an HD in Piwigo <2.3
We can also consider that hotlinking on a HD is a not relevant, so is it possible (with htacess) to detect hotlinking from a remote place and automatically redirect to the "medium" size instead.
We'll also have to deal with the hotlinked thumbnails: this is how the PiwigoMedia plugin works. This hotlink must not be broken when upgrading to 2.4.
Offline
The hotlink issue remains the biggest issue for upgrading to Piwigo 2.4.
Offline
This issue is still very disturbing for me. I don't know how to deal with it :-/
Offline
Let's remind the 3 issues: after upgrading to Piwigo 2.4,
1) the hotlink on the "web size" becomes a hotlink on the original
2) the hotlink on the HD no longer works
3) the hotlink on the thumbnail no longer works
After discussing with mistic100 (and this is also what suggests rvelices earlier in this discussion), URL rewriting is a solution for 2 and 3:
RewriteRule ^(upload/.*/TN-.*.jpg)$ redirect.php?path=$1&type=thumbnail [L]
RewriteRule ^(upload/.*/pwg_high/.*.jpg)$ redirect.php?path=$1&type=original [L]
The question is still opened for problem #1.
Offline
Maybe a Rewrite to page which will store the referrer and display the picture XL
an admin page will list the referrer and for each the old url and the new one to replace. with explicative text to explain why such an intervention is needed
Because it seems impossible to do something automatic
Offline
rvelices can you give an standard url to i.php with these two parameters : picture id (or picture path ?) and type (original/thumbnail) ?
I cant' find one in Piwigo sources
well... actually is it possible to direct link i.php ?
Last edited by mistic100 (2012-05-15 19:06:44)
Offline
here is what I have for now
RewriteEngine on
## redirect <2.4 thumbnails hotlinks to i.php
RewriteRule ^upload/(.*)/thumbnail/(?:TN-)?(.*)\.([a-z0-9]{3,4})$ i.php?/upload/$1/$2-th.$3 [L]
RewriteRule ^galleries/(.*)/thumbnail/(?:TN-)?(.*)\.([a-z0-9]{3,4})$ i.php?/galleries/$1/$2-th.$3 [L]
## redirect <2.4 high-def hotlinks to original file
RewriteRule ^upload/(.*)/pwg_high/(.*)\.([a-z0-9]{3,4})$ upload/$1/$2.$3 [L]
RewriteRule ^galleries/(.*)/pwg_high/(.*)\.([a-z0-9]{3,4})$ galleries/$1/$2.$3 [L]the only two problems I think can come from $conf['prefix_thumbnail'] and $conf['dir_thumbnail']
assuming that very few people change that we can provide the htaccess "as it" and give information and support to change if needed
anyway the question is how distribute the file ? some users have already a htaccess file, and it's rare that the server have permission to edit it himself
Offline
My 50 cents:
Assuming the issue impacts only hotlinks after upgrade to 2.4, htaccess file can't be distributed "as is" and set automatically. Is there any possibility to detect if hotlinks are set before upgrade?
If yes, maybe can we provide a warning message before upgrade to inform the webmasters they have to add the given rewrite rules in the htaccess file?
Offline
well as http requests don't go throught Piwigo but directly to the file system I can't figure out how to detect it
Offline
Of course, you're right. I think it was a little bit too late, yesterday evening, for my brain to work correctly ;-)
Anyway, in this case, hotlinks or not hotlinks do not matter : We can add the warning message and the way to add the right code in htaccess file for anybody who upgrade Piwigo to version 2.4. Adding the code in htaccess should not be mandatory but webmasters will be explicitly warned about the effects before upgrade.
Offline
mistic100 wrote:
well as http requests don't go throught Piwigo but directly to the file system I can't figure out how to detect it
a RewriteRule too with a condition on the referrer : it redirect to a page which display the picture needed but with a size XL and register the referrer
for conf issue : htaccess can be created/append dynamically by piwigo
Offline
flop25 wrote:
a RewriteRule too with a condition on the referrer : it redirect to a page which display the picture needed but with a size XL and register the referrer
I don't really think it's a good idea : for big and famous galleries there well be tons of referrers, impossible for the webmaster to contact them all
actually
Eric wrote:
Assuming the issue impacts only hotlinks after upgrade to 2.4, htaccess file can't be distributed "as is" and set automatically.
I don't understand the problem... if there are no hotlinks these rewrite rules won't never be used
flop25 wrote:
for conf issue : htaccess can be created/append dynamically by piwigo
are you sure ? I read that most hosts don't authorize PHP to modify htaccess files for obvious security reasons
Offline
are you sure ? I read that most hosts don't authorize PHP to modify htaccess files for obvious security reasons
I've got a cache plugin on my WP install and it has modified the htaccess. I'm not aware of such limitation, but we can provide the 2 way : trying to auto install the htaccess, and if it can't, piwigo provide a code to copy/paste and a file to download/upload with the right parameters $conf['prefix_thumbnail'] and $conf['dir_thumbnail']
Offline