Typically, when an image is linked to on a web page, it will open in a new window or navigate away from the current site. However, this is not always the desired result. The user’s expectation may be that the image would actually download to their computer. To handle such cases, imgix customers can now set the linked image URLs with the download dl
parameter. This modifies the HTTP headers of that image, forcing a web browser to download it instead of opening it in a web browser.
When linking to an image configured with imgix and setting the <a>
tag, use the dl
parameter to trigger the download. The dl
parameter should be set to a name you want used in the resulting file. The parameter fm
can be used to control the output format. Appending ?dl=original&fm=png
to a link will force the web browser to download that image as “original.png”.
The download parameter can be used with any combination of other imgix parameters to download specific variants. A typical case for this would be to download assets from a press kit, or screen sizes for a desktop wallpaper.
View the dl parameter in documentation.
Example Link Code
<a href="https://assets.imgix.net/examples/leaves.jpg?dl=original">Download</a>