Has anyone gotten the crop urls with razor? The 'Crops' property is empty.
I'm accessing my other properties simply like @sliderItem.Title, but @sliderItem.Crops is empty, eventhough umbraco.config shows a 'crops' node at the same level as 'Title'
I'm guessing I'll have to do the string manipulation on the original upload url
Hello sorry going round in circles, the above does not throw an error it displays the alt tag.
Don't really get the data type image cropper crops. I was expecting the image cropper to enable a new sized image to be created that could then be resaved with a different name in Media.
But as I understand it now the image cropper (with no ux clue that it has done so) saves the cropped information to an xml file called crop with attributes that you access using the word crops and the syntax .Find.
To use this new cropped image you then have to add some code to the template where you want the image to be placed referencing this crop file.
And now to my question, (if you are still with me!) I have been trying to use and understand what appears to be a very straight forward razor template from Chizzl's solution
but my code is not working. Please can you tell me why?
I took @yourCurrentNode to mean the current page and so I used Model, I want too access Media so .Media and then I got lost to which is the alias of my cropper. Within settings under Media Types and then Image I created a property under a Tab I named CropImageSize with an alias of cropImage and with the Type of, Image Cropper, so I used that.
(mainPageImage is one of the crop sizes I set up in the Image Cropper). I take it @name is the name of the image, which the code will get from the image file when its added to the page by the editor using the media picker.
Sorry for the long post but I wanted to eplain my understanding so that it could be corrected if I have misunderstood. I have watched the umbraco video 'image cropper dataType' by Tim but he is using xslt.
Thanks for any clue to why the image url of my cropped images is not being found. Karen
Get Crops with Razor syntax
Has anyone gotten the crop urls with razor? The 'Crops' property is empty.
I'm accessing my other properties simply like @sliderItem.Title, but @sliderItem.Crops is empty, eventhough umbraco.config shows a 'crops' node at the same level as 'Title'
I'm guessing I'll have to do the string manipulation on the original upload url
Maybe this can help you;
Chizzl,
Your link ends up on a 500 server errror:
Sadly enough I have no control over that website. I was only pointing to a blog article...
@Chizzl's solution works well:
@sliderItem.crops.Find("@name", "MainSlider").url
And now in MVC, it just needs this small edit to continue working:
@sliderItem.AsDynamic().crops.Find("@name", "MainSlider").url;
<img src="@Model.Media.cropImage.crop.crops.Find("@name","mainPageImage").url" alt="what the" />
Hello sorry going round in circles, the above does not throw an error it displays the alt tag.
Don't really get the data type image cropper crops. I was expecting the image cropper to enable a new sized image to be created that could then be resaved with a different name in Media.
But as I understand it now the image cropper (with no ux clue that it has done so) saves the cropped information to an xml file called crop with attributes that you access using the word crops and the syntax .Find.
To use this new cropped image you then have to add some code to the template where you want the image to be placed referencing this crop file.
And now to my question, (if you are still with me!) I have been trying to use and understand what appears to be a very straight forward razor template from Chizzl's solution
is working on a reply...