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:
Option 1 is:
[worksonmymachine.png](upload://wD4QT0WxzqkxFMKMI8QRQoRCcWC.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)
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.
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.
Option 1 was my first attempt, then I fell back to your EDIT
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?
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…
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
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.
I know, I know
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!
@codinghorror how dangerous is this? I found a solution that works locally, but may not work for CDN scenarios…
- Copy the image url from the preview window
- Get just the UUID portion
- 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.
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.
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.