Upload an image without embedding it

Hopefully a simple question that I’m over-complicating, but I cannot figure this out. Is there any way to upload an image to a post without embedding it? Basically, I’d want to attach an image file like you would a PDF so that it’s downloadable by clicking it.

Sure - just change the markdown generated by the upload as per below:


Original is:

![worksonmymachine|200x193,50%](upload://wD4QT0WxzqkxFMKMI8QRQoRCcWC.png)

resuliting in:
worksonmymachine


Option 1 is:

[worksonmymachine.png](upload://wD4QT0WxzqkxFMKMI8QRQoRCcWC.png)

worksonmymachine.png

EDIT: oops - that one doesn’t actually work… need to specify the full path:

[worksonmymachine.png](//assets-meta-cdck-prod-meta.s3.dualstack.us-west-1.amazonaws.com/original/3X/e/4/e4b06ce98ded89163747305342cf0074d4260202.png)

worksonmymachine.png


Option 2 makes it look like a usual “attachment” upload:

<a class="attachment" href="//assets-meta-cdck-prod-meta.s3.dualstack.us-west-1.amazonaws.com/original/3X/e/4/e4b06ce98ded89163747305342cf0074d4260202.png">womm.png</a> (31443 Bytes)

resulting in:
womm.png (31443 Bytes)

A left-click will still view the image. I don’t believe you can force a user to download the file; that’s controlled by the Content-Disposition header sent by the server.

2 Likes

Note that this is a very hacky “solution”, it might sort of work as a quick fix but I’m not sure I would recommend it as a general practice.

2 Likes

Option 1 was my first attempt, then I fell back to your EDIT :laughing:

Were you able to identify the full url before posting? I’m trying to come up with something that doesn’t require the user to “inspect” the image url in the preview…

Why don’t you construct the links in angle brackets?

cubicle_sweet_cubicle

https://d11a6trkgmumsb.cloudfront.net/original/3X/e/3/e3a33e7186437ab72d2fdcfb5f45c812ae25a571.gif

<https://d11a6trkgmumsb.cloudfront.net/original/3X/e/3/e3a33e7186437ab72d2fdcfb5f45c812ae25a571.gif>

Right-click, Copy image address?

Somehow the onebox viewer provides a download link…

image

EDIT: Well, that didn’t demo like I thought it would…

Did you add the angle brackets as I said?

<https://d11a6trkgmumsb.cloudfront.net/original/3X/e/3/e3a33e7186437ab72d2fdcfb5f45c812ae25a571.gif>

Clicking that a link with angle brackets displays the image in the browser rather than downloading it :frowning:

I’m seeing in the image viewer a download link that is a different image URL. Trying to track the source of that link down now…

EDIT: …and determine if that link is available at post time.

Right click it and select “Save Link As…” – this works on any link in the browser.

I know, I know :slight_smile:

The use case is posting items for download as a meeting summary. Those items will sometimes be PDFs, Word docs, slide decks, and images. It would be weird if some some links downloaded and others displayed, right?

If it’s really so necessary, create a new PDF with the image in it? This is a trivial operation in Word, new doc, paste image, save as PDF.

Okay, I have a handful of workarounds to consider. I really appreciate you guys’ help working through this. Thanks for the quick responses. You guys rock @codinghorror and @supermathie!

2 Likes

@codinghorror how dangerous is this? I found a solution that works locally, but may not work for CDN scenarios…

  1. Copy the image url from the preview window
  2. Get just the UUID portion
  3. Hack the link to be /uploads/default/{UUID}

For example:

[Cool image to download](/uploads/default/a099b7b187922f26fbebbbb47807fc83da11fc55)

One a scale of 1 to close your computer and go home for the weekend, how dangerous is this?

@sam says it’ll get deleted by the automatic unreferenced image tombstoning task, so… as predicted… bad idea.

1 Like

As an admin the hack @supermathie suggested will work if you also upload the image totally normally on a different staff only topic. Or in a PM to yourself. That way it will not be deleted.

3 Likes

Is the task looking for the upload:// link in posts?

no it looks for actual images which are linked uploads to the post. I do am no 10000% certain but I don’t think we track an association for A HREF to upload, but maybe I am wrong need to review the code.

2 Likes

I have got an easy solution to this.
Just decrease your max image width and max image height with some small no. like 250px X 250px
Then all the images bigger then this will be send as attachment and you expand it and a card will open which have download option.
Images for reference-