I'm in need of retrieving on the fly an image from the media section and all that I have is the id of the media. Are there any methods or other ways which would give me the image when using only the id. Could be:
Thanks for your reply, but I'm afraid it's a bit more complicated. As i wrote, I need the image on the fly - basically after getting the id through an ajax call. So I'm not able to run any xslt or similar. Thus I need a way to get the image in such a way that I can output it like this:
I'm considering doing a second ajax call just to get the image url string back in the ordinary way (using xslt), but I prefer not as it means yet another server call for what is really just a detail on the page.
Any method for getting media node with correct content-type?
I'm in need of retrieving on the fly an image from the media section and all that I have is the id of the media. Are there any methods or other ways which would give me the image when using only the id. Could be:
This should (if the id actually corresponds to an image) output a image with the correct content-type.
I assume this should not be very complicated to create, but if it exists, I would prefer not to... ;)
hi,
Yes, you can retrieve the image using a macro / xslt
Something like (not tested)
Rich
The above assumes it's an image, not sure if if thats what you're asking?it's late here... hope it helps in someway.
Rich
Hi Rich,
Thanks for your reply, but I'm afraid it's a bit more complicated. As i wrote, I need the image on the fly - basically after getting the id through an ajax call. So I'm not able to run any xslt or similar. Thus I need a way to get the image in such a way that I can output it like this:
I'm considering doing a second ajax call just to get the image url string back in the ordinary way (using xslt), but I prefer not as it means yet another server call for what is really just a detail on the page.
Nik
Hey Nik,
Understood, pretty sure Umbraco base is what you would need
http://our.umbraco.org/wiki/reference/umbraco-base
http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco/base-and-ajax-development/introduction-to-base
Rich
is working on a reply...