Glass Carter Render Image data attributes

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

+4
source share
2 answers

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

+3
source

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:

@RenderImage(image, x => x.Image, new { Width = 100}, isEditable: true)

, , ImageParameters, . , , .

+7

All Articles