Image Resizing

Image Resizing

Written by Inian Parameshwaran
Last update: Wednesday, Jul 01, 2020

Automatic resizing of images

Dexecure automatically resizes images based on the device form factor. For mobile devices, images are ensured to have a width less than 980px and height less than 1742px. For desktop devices, images are ensured to have a width less than 1920px and height less than 1200px

Disable automatic resizing of images

To disable this automatic resizing of images, provide ?resize=none as a query parameter like this.

https://your-dexecure-domain.com/fluffy-kitten.jpg?resize=none

Resizing to a specific dimension

Use the ?resize=wX,hY parameter to provide width w and height h values X,Y > 0 to resize an image. Aspect ratio is always maintained. Image is resized such that it fits into a box of the given width and height dimensions.

For example, if resize dimension is w50,h50 and the original image dimensions are 200x100, then the resulting image will have dimensions of 50x25

https://your-dexecure-domain.com/fluffy-kitten.jpg?resize=w200,h350

Either or both of w and h can be provided. The other dimension is appropriately scaled to maintain aspect ratio of the image.

Providing different resize values for mobile and desktop

Using ?resize=wX,hY resizes the image to width w and height h on all device form factors. You may want to provide different resize parameters depending on the end user's device form factor. This can be achieved using the m_resize parameter. The syntax is the same as the resize parameter.

https://your-dexecure-domain.com/fluffy-kitten.jpg?resize=w200&m_resize=w100

For example, the above URL resizes the image to 200px wide on desktop and 100px wide on mobile.

Dexecure never upscales an image to be bigger than the original image dimensions unless fit=blur is provided. You can read more about it here.

URL Configuration

Configure the behaviour of Dexecure via URL Query Parameters

7 articles in this category.
Written by Inian Parameshwaran.