•  » Engine
  •  » [multisize] hotlinks and upgrade

#1 2012-01-18 17:46:08

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13963

[multisize] hotlinks and upgrade

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

 

#2 2012-01-18 19:25:48

rvelices
Former Piwigo Team
2005-12-29
1960

Re: [multisize] hotlinks and upgrade

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

 

#3 2012-01-30 13:11:28

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13963

Re: [multisize] hotlinks and upgrade

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

 

#4 2012-04-19 23:08:02

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13963

Re: [multisize] hotlinks and upgrade

The hotlink issue remains the biggest issue for upgrading to Piwigo 2.4.

Offline

 

#5 2012-05-07 22:40:19

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13963

Re: [multisize] hotlinks and upgrade

This issue is still very disturbing for me. I don't know how to deal with it :-/

Offline

 

#6 2012-05-08 00:10:41

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13963

Re: [multisize] hotlinks and upgrade

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

 

#7 2012-05-08 11:53:08

flop25
Piwigo Team
2006-07-06
7037

Re: [multisize] hotlinks and upgrade

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


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#8 2012-05-15 19:05:30

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [multisize] hotlinks and upgrade

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

 

#9 2012-05-16 23:12:03

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [multisize] hotlinks and upgrade

here is what I have for now

Code:

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

 

#10 2012-05-17 00:09:26

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: [multisize] hotlinks and upgrade

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

 

#11 2012-05-17 00:20:30

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [multisize] hotlinks and upgrade

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

 

#12 2012-05-17 11:46:53

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: [multisize] hotlinks and upgrade

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

 

#13 2012-05-17 11:50:34

flop25
Piwigo Team
2006-07-06
7037

Re: [multisize] hotlinks and upgrade

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


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#14 2012-05-17 11:59:55

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [multisize] hotlinks and upgrade

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

 

#15 2012-05-17 12:04:19

flop25
Piwigo Team
2006-07-06
7037

Re: [multisize] hotlinks and upgrade

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


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 
  •  » Engine
  •  » [multisize] hotlinks and upgrade

Board footer

Powered by FluxBB

github linkedin newsletter Piwigo.org © 2002-2025 · Contact