Page MenuHomePhabricator

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

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

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 3:54 AM
bzimport set Reference to bz72328.
bzimport added a subscriber: Unknown Object (MLST).

I use this for dynmaic thumb resizing with javascript.

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 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.Nov 26 2014, 7:13 PM
Subfader updated the task description. (Show Details)

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.

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

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

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:14 AM