I recently released a new version of my site where I utilise the medium format provided by the media library. To my surprise it was sometimes missing.
It turns out that some formats are not generated if Strapi deems it unnecessary. Although I understand the sentiment I think that it makes for a so-so API. We now have to add a fallback in case the desired format is not present.
How about always providing small, medium and large? In the case that the image is too small to be in a certain size I propose you use the original url instead. That way the API stays consistent and extra image processing isn’t made.
Hi, not sure I understand your question @DMehaffy here ?
This is a matter of opinion here.
We consider that giving the original url for a format that will not match is not a good practice (give 500px for a large image when we expect 1000x for ex)
It is to the user to decide weather they want to display the original or display something else. If we return a url for every format you have no way to know it is actually the original. You would need to add more metadata or do comparaisons so that would still require some “processing” to take a decision. In that regard we consider it makes more sense to return what exists and ask the sure to handle the fallback how they see fit.