Hosting external images

HI,
it is possible to link images hosted on a different server than the hype resources folder?

I need it for a client.

thank you

m

Hi,
Yes there are a couple of ways to do that.
But not directly through the choose image.

You would have to use either the innerHTML of an element and use IMG tags. Or/and JavaScript in a function that sets the src of an image

The are many, many examples of all of this on the forum.

This may make a good request though to be able to link to an external image via the choose image/ insert image dialogue.

thank you!
honestly I've searched for it in the forum, but I found anything...
maybe the javascript way could be better to me.

m

Some of the search results for image src

For example
<img src="https://forums.tumult.com/uploads/db2156/original/2X/b/b3371f9b65373b4ba9abbaee4c43cdc834bfc5b5.png">

would produce this.

2 Likes

thank you so much!!!!!!!!

very kind!

m

Hype also has an event named 'HypeResourceLoad' this'll fire when a resource is preloaded or loaded. It offers the possibility to hook in and – for example – swap an image-url.

So this basic example shows how to do this. just copy paste it to your documents head ...

	<script>
	function HypeResourceLoadCallback(hypeDocument, element, event) {
	
	var resourceName = event.url.substring(event.url.lastIndexOf('/')+1);
	var swapPath = 'https://your.com/funny/new/path/';
	var newResourcePath = swapPath + resourceName;
	console.log(newResourcePath)
	return newResourcePath
	}

if("HYPE_eventListeners" in window === false) { window.HYPE_eventListeners = Array(); }
window.HYPE_eventListeners.push({"type":"HypeResourceLoad", "callback": HypeResourceLoadCallback});
	</script>

malu.hype.zip (128.2 KB)

///////////////

you may also search the forum for a post of @MaxZieb who did this by integrating a professionell service

3 Likes

beautiful solution!
thanks !!