zerodevx / svelte-img

High-performance responsive/progressive images for SvelteKit
https://zerodevx.github.io/svelte-img/
ISC License
300 stars 11 forks source link

Download link for unedited original #15

Closed AaronNBrock closed 11 months ago

AaronNBrock commented 1 year ago

I'd like to have a permalink to the image w/ a human friendly url like (/images/my-image.jpg) for both allowing people to reference the image externally & for having "download" link.

What would be the suggestion for achieving this using svelte-img?

zerodevx commented 1 year ago

Importing an image using the import x from '$lib/a/img.jpg construct generates its variants, with each variant renamed to something like <filename>-<hash>.<ext>. I kinda think given your requirements, it's probably best to treat image statically and place it in the /static folder without transformation. Else, which image should be referenced externally? (since the exact variant served depends on browser media queries)

AaronNBrock commented 1 year ago

I would like both. On my site I'd like the images to generate variants and serve based on the size of the window for fast load times. However, I'd also like a direct link of the original for a "download" button ~ of if I want to embed images on my site on Reddit posts for example.

What I really want is images to both be in the static directory and to be imported.

zerodevx commented 11 months ago

You can place your unedited images into the /static folder and import the image from there? Going to close this for now, feel free to reopen if I missed something.