Page MenuHomePhabricator

When a larger-than-original thumbnail is requested from thumb.php, return original image instead of HTTP 500 error
Open, LowestPublic

Description

As title says: If a width larger than the original is called, return original image instead of error.


Version: 1.22.12
Severity: enhancement

Details

Reference
bz72328

Event Timeline

bzimport raised the priority of this task from to Lowest.
bzimport set Reference to bz72328.
bzimport added a subscriber: Unknown Object (MLST).
Subfader created this task.Oct 21 2014, 6:27 PM
Tgr added a comment.Oct 21 2014, 8:09 PM

Why should this happen?

I use this for dynmaic thumb resizing with javascript.

Tgr added a comment.Oct 22 2014, 5:44 PM

How does returning the original help? If you know the size of the original, you can just cap the requested size on the client size. If you don't know the original size, the result will look crappy anyway.

Returning the original image for a practically infinite variety of URLs would AFAIK result in pollution of the varnish cache as the image would have to be stored there for every URL separately.

Check if viewport has enough width to display the 500px image.

Call thumb.php?f=Foo.jpg&w=500 > Displays a 500px thumb or a smaller original

How does returning an error help?

Tgr renamed this task from thumb.php: If upscale: Return original image instead of error to When a larger-than-life thumbnail is requested from thumb.php, return original image instead of HTTP 500 error.Nov 26 2014, 1:08 PM
Tgr set Security to None.

See also T75935

Subfader updated the task description. (Show Details)Nov 26 2014, 7:13 PM
Subfader renamed this task from When a larger-than-life thumbnail is requested from thumb.php, return original image instead of HTTP 500 error to When a larger-than-original thumbnail is requested from thumb.php, return original image instead of HTTP 500 error.
Tgr added a comment.Nov 26 2014, 7:27 PM

As a quick and dirty workaround, you can use index.php?title=Special:Redirect/file/Foo.jpg&width=500 which will do a redirect if the file is smaller. It probably does not accept all the parameters thumb.php does, though.

Tgr: Thanks, the redirect works.

This ticket in other words: If the referenced file exists, thumb.php should always return an image and no error.

Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:08 PM
Restricted Application added subscribers: Steinsplitter, Matanya, Aklapper. · View Herald TranscriptSep 4 2015, 6:08 PM
Restricted Application added a project: Commons. · View Herald TranscriptNov 10 2016, 5:35 PM
bearND added a subscriber: bearND.Nov 10 2016, 5:36 PM

Solving this or T75935 would help the apps and Mobile Content Service users a lot.

Restricted Application added a subscriber: Poyekhali. · View Herald TranscriptNov 10 2016, 5:36 PM

Change 332425 had a related patch set uploaded (by Mholloway):
thumb.php: Redirect rather than throwing 400 if requested width >= original

https://gerrit.wikimedia.org/r/332425

Change 332425 abandoned by Mholloway:
thumb.php: Redirect rather than throwing 400 if requested width >= original

Reason:
Seems not viable as written. Discussion to be continued on the linked Phab tasks.

https://gerrit.wikimedia.org/r/332425