I'm trying to get the src for an image cropper object within my Master template file, to use in a tag.
For some reason, @Model.Value("thumbnail") returns the URL no problem. However, when I add another string to it, for example: @(url + Model.Value("thumbnail") it appears to just render a string of the whole cropper object (See image).
I have tried a bunch of various things, but it's been so long since I've worked with Umbraco I'm failing massively!
Image cropper not returning path in master.cshtml
I'm trying to get the src for an image cropper object within my Master template file, to use in a tag.
For some reason, @Model.Value("thumbnail") returns the URL no problem. However, when I add another string to it, for example: @(url + Model.Value("thumbnail") it appears to just render a string of the whole cropper object (See image).
I have tried a bunch of various things, but it's been so long since I've worked with Umbraco I'm failing massively!
Hey Christopher, What I would be tempted to do is something like this:
then you join the two together
What does that give you?
Are you able to share more of your code at all to allow us to help a bit more?
Cheers,
Hey Owain,
I tried similar last night and ended up with pretty much the same as this just after posting this thread and it still seems to return the same.
Then, I am using it like this:
And it returns the following:
Ah! So, with the imagecropper you are probably best checking out : https://our.umbraco.com/documentation/getting-started/Backoffice/Property-Editors/Built-in-Property-Editors/Image-Cropper/
You can
.getGropUrl
which should give you the url rather than the string that you are currently getting.Hi,
Thanks again, I've tried a bunch of different ways, nothing seems to work for me :(
Test #1: var image1 = Model.Value("thumbnail").GetCropUrl(); Results in:
Test #2:
Results in:
Test #3:
Results:
Test#4
Results:
Hey Christopher, What property picker are you using in the backoffice for picking the image?
O.
Hi,
It's using the ImageCropper property
Rather than
Model.Thumbnail.GetCropUrl("thumbnail")
go forModel.Image.GetCropUrl("thumbnail")
Hey,
That returns:
Are you able to do a screenshare? I'd be happy to have a look that way, might be easier.
O.
Hey,
That would be great. I'm in my day job at the moment though. I can do one this evening if you are free? (Around 8:30pm UK time)
Either that, or I can set you up with an Umbraco user login for my site?
Thanks for your help :-)
Cool. Drop me an email - * or if you are on Slack http://umbracians.chat/ give me a shout.
If you add me to your project, I can probably have a look today. I'm doing a talk at a meetup tonight.
If anyone else stumbles across this - the issue seems to be an early Umbraco 8 version bug.
https://github.com/umbraco/Umbraco-CMS/issues/5737
Hopefully a CMS upgrade will fix things :)
O.
is working on a reply...