Getting the crop URL from an image that is cropped in Media, not on a page, using razor?
Hi!
I have put and Image Cropper on the image media type so I can create cropped versions of the images I upload in the media section. On my pages I have a Media Picker where you can pick an image from the media section. All this works fine, but I can't figure out how to get a cropped version of the image I've picked.
This is the farthest I've come so far:
@node.Media("blogPostImage", "imageCrops")
In the example above @node is the current node (page) in a foreach iteration. All nodes that are iterated have a media picker property called "blogPostImage". All images in the image archive have an image cropper property called "imageCrops". The result I get when I run the code above is this:
Now I want the url of one of the crops, in the example above it's called "Liggande bild" (panorama image in Swedish).
Sifting through the forum and the web there are lot's of suggestions and examples, but most of them are not relevant in this case since they are either based on DAMP 2.0 or are for cases when the image is uploaded and cropped on the page.
I've seen some examples where people use helper functions, but I can't seem to get that to work.
Getting the crop URL from an image that is cropped in Media, not on a page, using razor?
Hi!
I have put and Image Cropper on the image media type so I can create cropped versions of the images I upload in the media section. On my pages I have a Media Picker where you can pick an image from the media section. All this works fine, but I can't figure out how to get a cropped version of the image I've picked.
This is the farthest I've come so far:
In the example above @node is the current node (page) in a foreach iteration. All nodes that are iterated have a media picker property called "blogPostImage". All images in the image archive have an image cropper property called "imageCrops". The result I get when I run the code above is this:
Now I want the url of one of the crops, in the example above it's called "Liggande bild" (panorama image in Swedish).
Sifting through the forum and the web there are lot's of suggestions and examples, but most of them are not relevant in this case since they are either based on DAMP 2.0 or are for cases when the image is uploaded and cropped on the page.
I've seen some examples where people use helper functions, but I can't seem to get that to work.
I'd really appreciate some help with this one!
Regards,
Thomas Kahn
Never mind.
I'm reverting to XSLT.
How Do you do?
Oh, hi!
This was ages ago so I had to sift through some old code to find the XSLT-based solution that I finally settled for:
This works fine in my solution. The variable $item is a node that comes from a for-each loop.
Thank, but I need for Razor.
is working on a reply...