DMarby / picsum-photos

Lorem Ipsum... but for photos.

Home Page:https://picsum.photos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request that was previously working isn't working anymore

MoritzLost opened this issue · comments

We've been using the following URL in a script that generates some demo content:

https://picsum.photos/id/1022/6000/3376

Up until recently, this request worked correctly and returned the original image. This has recently stopped working, the URL now return a HTTP 400 error with the message Invalid size. I'm trying to find out why this has stopped working.

Looks like the limit is 5000x5000, but this has been the case for two years. But up to a couple of days ago, the request worked correctly. Looks like this recent commit might be what's causing the change, the commit message seems to indicate this:

Disallow requesting exact source image size
Resize source images to 5k by 5k pixels so they fit within the allowed limits

We were using the exact dimensions of the source image from Unsplash, because we wanted the original image. If I understand correctly, our request with a size of >5000px width only worked because we were requesting the exact dimensions of the original image. But since this recent commit, the API never returns the original image, so now the request above is hitting the size limit?

In this case, is this change and/or the exact limit for image sizes documented anywhere? There's no mention of a size limit on the website.

Hi there,

Sorry about the trouble this has has caused you, the maximum size limit was indeed changed recently, as it was 5000x5000 with the exception of also supporting the specific dimensions of an image as listed in the list endpoints (/v2/list et-al).
To cut down on cache size and processing, and as these exact dimensions were requested very rarely, that was removed recently, and the source images were re-sized to all fit into the 5000x5000 bounding box.

The maximum size limit is now exclusively 5000x5000, and the max dimensions of an image can be requested by either setting the width/height to 0, or using the download_url or height/width from the list endpoints, which were also updated to the new dimensions with this change.

I've tried to keep Picsum as backwards compatible as possible, as such there have been very few API breakages over 8+ years, but unfortunately a breaking change was necessary in this case.

@DMarby Thanks for the thorough explanation!