This PR changes the default to not return images larger than the source. It adds an enlarge modifier which disables this, and allows larger images to be returned.
The PR also makes two additions: it adds meta to the handler context, so handlers have access to details of the source image. It adds a new clampDimensionsPreservingAspectRatio util. We can't use sharp's withoutEnlargement when specifying both dimensions, because that doesn't preserve the requested aspect ratio. Instead we calculate the dimensions ourselves.
This PR changes the default to not return images larger than the source. It adds an
enlarge
modifier which disables this, and allows larger images to be returned.The PR also makes two additions: it adds
meta
to the handler context, so handlers have access to details of the source image. It adds a newclampDimensionsPreservingAspectRatio
util. We can't use sharp'swithoutEnlargement
when specifying both dimensions, because that doesn't preserve the requested aspect ratio. Instead we calculate the dimensions ourselves.Fixes #39