Page MenuHomePhabricator

Keep image links alive after move
Closed, DeclinedPublic

Description

$wgAllowImageMoving=true; has a major disadvantage: All hotlinked images die after the image is moved.
But I like to encourage people to hotlink images from my wiki like Commons does with its "use this image on the web" feature.
Therefor I'd like to keep images alive after they're moved.

I see several possible solutions:

  1. A global to "don't delete old file and thumbs" = move image page, copy original file AND thumb files.

I.e. an old unused 300px thumb should also be there after the move.
Problem: Old files are not seperated. This makes "flushing" the current thumbs impossible.

  1. /wiki/thumb.php should recognize moved file names. On image pages I use links like thumb.php?w=320&f=Old.jpg as an option to hotlink custom thumb sizes. If Old.jpg is moved to New.jpg, thumb.php?w=320&f=Old.jpg should still work.

Problem: Double redirects.

  1. A "use this image on the web" feature copies a selected file to a "static" destination, e.g. a subfolder or a subdomain like static.mywiki.com/images/. The subdomain variation could use the same hash directory structure.

Problem: Activating the copy action via link on the image page. Javascript?


Version: unspecified
Severity: enhancement

Details

Reference
bz27917

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 11:24 PM
bzimport set Reference to bz27917.
bzimport added a subscriber: Unknown Object (MLST).

Leave the redirect at the old file name works fine...

I talk about hotlinked images. Those do not work after the image move.

I Imagine it'd be fairly easy to do option 2 (thumb.php support image redirects). The issue with that is then it becomes inconsistent, with installs using direct links having the direct links not support redirects.

Option 3 seems like the wrong way to do this. For option 1 maybe if it did symbolic links (I don't know enough about how we store files in the filesystem to know if thats a bad idea or not)

Bryan.TongMinh wrote:

We can support redirects in wikimedia's webstore backend

Hotlinking should be done through Special:FIlePath as of 1.17

http://commons.wikimedia.org/wiki/Special:FilePath?file=Sample.jpg&width=20

This also supports redirects

Addndm:

Hotlinking to the raw path is always a bad idea and should not be encoured, for all you know you may want to migrate to a seperate server/subdomain for storing media, or perhaps enable/disable md5-paths at which points stuff will break again.

I think there's a duplicate of this bug (can't find it), but I remember there Roan mentioned something about cache and thumb.php afaik it caches less or not at all. thumb.php is not meant to be referenced directly in the front-end.

Thanks for http://commons.wikimedia.org/wiki/Special:FilePath?file=Sample.jpg&width=20
didn't know that option.

Meanwhile I created option 3) myself without javascript and a php script in the destination folder. It saves the file via /wiki/thumb.php.

Main advantage: File stays 100% the same version after re-uploading.

**Main advantage: File stays 100% the same version after page move, re-uploading, or deletition.