Topic: Media urls and using them in the html tool

I need to reference an image uploaded to the RC directly in the html of the html tool. How to I access:

a) the actual url of the image (without the time-based variable)?
b) Or if this is not possible are there any shortcodes that can be used to embed the image?


For example in an img tag like so:
<img style="position: absolute; z-index: 1;" src="" alt="" />

how to do I complete the src attribute?
All I can locate are the temp (time-based) urls.

2 (edited by Garrett Lynch 2021-06-21 16:08:32)

Re: Media urls and using them in the html tool

Documenting the solution I used here in case it's of use to anyone else. Here's what I did:

1) Any images that are vectorial in style - try to substitute them with pure CSS solutions.
2) For images that are bitmap in style (e.g. photographs) - use an image to dataurl converted (e.g. https://ezgif.com/image-to-datauri) and then embed the image using the dataurl e.g. <img src="data:image/jpeg;base64,/9j/4AAQSkZJR" />. Make sure you scale your image to the size you are going to use it and compress as jpg before you convert it. Images > 800kb will probably cause you problems (many thanks to the RC User Help for suggesting this!).

Re: Media urls and using them in the html tool

Dear Garreth,

Thank you! this is what I wanted to suggest and I've used this technique myself as well a few times. The thing to watch out for is overloading a single HTML tool with many big images, since this can slow the editing down a lot or make it difficult. But as long as you keep the size per tool under control, there is not much risk in using this method. Indeed, I would recommend using JPG for bigger images, otherwise also loading times may become a problem.

The RC currently does not have a way of generating static links for media, the reason for this also has to do with that we have to control access to media: media that is used in a private exposition should not be visible through a static link. Also having a static link to a media file could be abused to use the RC as a file hosting service (the RC aims to be a platform for the contextualization of artistic research results). However, we are looking into making it possible to "embed" media within HTML and text tools, a bit similar to how media in the text-based editor works. So embedding inline images should become easier in the future. In general inserting images inline with a text will be a lot easier once we have the 1d-editor for graphic expositions becomes available. We expect this to be released later this year, so stay tuned!

Re: Media urls and using them in the html tool

casper.schipper wrote:

Dear Garreth,
The RC currently does not have a way of generating static links for media, the reason for this also has to do with that we have to control access to media: media that is used in a private exposition should not be visible through a static link. Also having a static link to a media file could be abused to use the RC as a file hosting service (the RC aims to be a platform for the contextualization of artistic research results). However, we are looking into making it possible to "embed" media within HTML and text tools, a bit similar to how media in the text-based editor works. So embedding inline images should become easier in the future. In general inserting images inline with a text will be a lot easier once we have the 1d-editor for graphic expositions becomes available. We expect this to be released later this year, so stay tuned!

That's good news. I was going to suggest some sort of shortcodes for the media so the requests can be checked as internal requests within RC (avoiding the hotlinking you mentioned) but it sounds like you are already solving that in some similar way. Many thanks.