I am trying to display an image field using RenderImage. I need some data attributes on the image, but I cannot figure out how to implement this. I tried this but it does not work.
@RenderImage(image, x => x.Image, new RenderingParameters("data-protect=true"), isEditable: true)
thank
Try the following:
@RenderImage(image, x => x.Image, new ImageParameters { Width = 100}, isEditable: true)
As in the latest version of Glass - the only possible solution is
@RenderImage(image, x => x.Image, new { Width = 100}, isEditable: true)
You can also take a look at Tutorial 16 - RENDERING IMAGES
Although the answer above will work, I'm going to remove support for ImageParameters in the future and move on to support only anonymous type:
, , ImageParameters, . , , .