Hello, I am trying to use the NivoSlider but when the view tries to fill in the src tag of the image with a call to umbracofile it is getting populated with this:
Hmm when you mention NivoSlider are you then doing your own implementation of it ore are you basing it on the package here https://our.umbraco.org/projects/website-utilities/nivoslider-for-umbraco/ ? I'm not sure whether this package still works since it's 5 years old and made in a time where Umbraco 4 was new...However it might be an evergreen package that just works no matter how much changes in Umbraco.
The first code part is that the rendered code you see when viewing your website?
Perhaps it would be easier to figure out if you posted a code sample where you call the @image.GetPropertyValue("UmbracoFile") to figure out where things go wrong - I suspect it's because underlying API to fetch the content has changed since the NivoSlider package was made (If that is what you're using).
Sebastiaan your solution looks good but its not working. here is how the variable image is created:
var image = slide.MediaById(imageID);
I get error loading partial view script when i use src='@image.GetCropUrl("UmbracoFile")'
Can either of you point me to a document that maps out all of the API calls available in Umbraco? Unfortunately i am not getting a lot of intellisense support with .cshtml pages. I have tried both visual studios 2013 and web matrix. I am new to razor code by the way. Thank you for your responses.
just wanted to let you know that i found a way to make
var file = mediaItem.umbracoFile.src
and i think I could apply GetCropUrl in a similar way if need be. The code was causing errors inline so i pulled it out to a code block and just used the variable file inline. Thanks for your help with this.
umbracofile img src html not well formed
Hello, I am trying to use the NivoSlider but when the view tries to fill in the src tag of the image with a call to umbracofile it is getting populated with this:
src='{ "src": "/media/1038/slide2.jpg", "focalPoint": { "left": 0.48785425101214575, "top": 0.49685534591194969 } }'
which breaks the image display.
the call is src='@image.GetPropertyValue("UmbracoFile")'
I would go directly to the URL if I knew how but I'm not sure how to see what properties can be used with the default media object.
any help would be appreciated.
Hi Robert and welcome to our :)
Hmm when you mention NivoSlider are you then doing your own implementation of it ore are you basing it on the package here https://our.umbraco.org/projects/website-utilities/nivoslider-for-umbraco/ ? I'm not sure whether this package still works since it's 5 years old and made in a time where Umbraco 4 was new...However it might be an evergreen package that just works no matter how much changes in Umbraco.
The first code part is that the rendered code you see when viewing your website?
Perhaps it would be easier to figure out if you posted a code sample where you call the @image.GetPropertyValue("UmbracoFile") to figure out where things go wrong - I suspect it's because underlying API to fetch the content has changed since the NivoSlider package was made (If that is what you're using).
Looking forward to hearing more from you.
/Jan
This should fix it:
src='@image.GetCropUrl("UmbracoFile")'
Thank you Jan and Sebastiaan, I am using a newer version found here:
https://our.umbraco.org/projects/website-utilities/slider
Sebastiaan your solution looks good but its not working. here is how the variable image is created:
var image = slide.MediaById(imageID);
I get error loading partial view script when i use src='@image.GetCropUrl("UmbracoFile")'
Can either of you point me to a document that maps out all of the API calls available in Umbraco? Unfortunately i am not getting a lot of intellisense support with .cshtml pages. I have tried both visual studios 2013 and web matrix. I am new to razor code by the way. Thank you for your responses.
just wanted to let you know that i found a way to make
var file = mediaItem.umbracoFile.src
and i think I could apply GetCropUrl in a similar way if need be. The code was causing errors inline so i pulled it out to a code block and just used the variable file inline. Thanks for your help with this.
is working on a reply...