On the homepage I have a partial that gets the 4 most recent news. The first is a 'highlighted' one that should have a 200x200 size, and the remaining 3 will have a 100x100 size. To manage the images, I have added a ImageCropper property. The user also has the option to overwrite the 'highlighted' one by using a content picker on the homepage and selecting which news will be highlighted.
The issue is, I am not able to manage ImageCropper to work. Most of the examples I saw use Model.Image, but I'm not using Model, since I'm bringing the notes in a foreach.
I also tried something like this:
var foto = noticia.Value<IPublishedContent>("image").GetCropUrl(100,100);
When using that, I get the following error:
CS1503: Argument 1: cannot convert from 'method group' to 'HelperResult'
I also tried:
var foto = @(noticiaDestaque.Value<IPublishedContent>("imagemDestaque").GetCropUrl(100,100));
Then I get: Value cannot be null.
Parameter name: mediaItem
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: mediaItem
Although the image is there.
So I am a bit confused on what should be the correct approach.
Is someone able to help me out?
ImageCropper on IPublishedContent
Hi,
I have the following structure on my site:
On the homepage I have a partial that gets the 4 most recent news. The first is a 'highlighted' one that should have a 200x200 size, and the remaining 3 will have a 100x100 size. To manage the images, I have added a ImageCropper property. The user also has the option to overwrite the 'highlighted' one by using a content picker on the homepage and selecting which news will be highlighted. The issue is, I am not able to manage ImageCropper to work. Most of the examples I saw use Model.Image, but I'm not using Model, since I'm bringing the notes in a foreach. I also tried something like this:
When using that, I get the following error: CS1503: Argument 1: cannot convert from 'method group' to 'HelperResult'
I also tried:
Then I get: Value cannot be null. Parameter name: mediaItem Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: mediaItem Although the image is there.
So I am a bit confused on what should be the correct approach. Is someone able to help me out?
This is my code:
Hi,
Use a typed media. Will need to check an image is picked.. this is written from memory but should help you.
Something like:
Hey Steve
I tried that and got the following:
CS1503: Argument 1: cannot convert from 'method group' to 'Udi'
I also tried changing it into two variables:
But got the following: CS0815: Cannot assign method group to an implicitly-typed variable
Hi,
Just try writing out to the page the value of fotoTyped - it's hard to see what you have here and where your error is being thrown.
You did replace
with
is working on a reply...