Link to download image instead of image

I need to provide website visitors with a link to download the original high-resolution image. If I just snap to the image using href = "image.jpg", the browser will display the image. How to make the browser load it?

I use amazon S3 to work with these images ... If this requires a special caption on the image, I am sure it is possible ... but I also want to display these images. Any advice on making this work with S3 would be great.

+3
source share
2 answers

You're right. Some headings are needed for this. This will:

Content-type: image/png
Content-Disposition: attachment; filename="some_image.png"

, S3 , , Content-Disposition .

EDIT: <img src="some_image.png" alt="" /> . .

+4

, :

Content-Disposition: attachment; filename=<file name.ext>
0

Source: https://habr.com/ru/post/1763439/


All Articles