I've successfully saved an image through the Services.MediaServices-API. I've also successfully saved an image cropper value to a page (if I have the path/url to the image). What I can't figure out is how to get the newly saved image's URL?
I've tried several things, like calling Services.MediaServices.GetById(XXXX).Path and also some variants with .umbracoFile - nothing works.
Save an image and then get its path?
Hi Umbraco Developers!
I've successfully saved an image through the Services.MediaServices-API. I've also successfully saved an image cropper value to a page (if I have the path/url to the image). What I can't figure out is how to get the newly saved image's URL?
I've tried several things, like calling
Services.MediaServices.GetById(XXXX).Path
and also some variants with .umbracoFile - nothing works.Any pro out there who can shed some light ?
Hi,
once you have saved a media item and want to present it to the front end, then using the UmbracoHelper should work, (so in a partial or macro)
should return the virtual path (like "/media/1092/image.gif")
however if you want to say in the back office with the services, you can access it via GetValue so
this will still be the virtual path, so you might need to map it. in the umbraco back office IOHelper can do that.
*All of the above assumes you are not using the image cropper, - as that stores JSON in the umbracoFile property.
Kevin! You're officially the best! Thx a bunch!
is working on a reply...