Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have been able to successfully display a cropped image when hard coding the width and height values using the GetCropUrl method as shown below.
<a id="@item.image" href="@featureImage.Url" title="@item.imageDescription"> <img class="img-responsive" src="@featureImage.GetCropUrl(270, 161, furtherOptions:"&filter=comic")" alt="@item.Name"/> </a>
However I would like to set this value in the node content and pass them in. For example I have create a property call imageWidth.
<p>@item.imageWidth</p> <a id="@item.image" href="@featureImage.Url" title="@item.imageDescription"> <img class="img-responsive" src="@featureImage.GetCropUrl(item.imageWidth, 161, furtherOptions:"&filter=comic")" alt="@item.Name"/> </a>
Unfortunately I get the following error
In the paragraph tag it does show the property value I have set in the node at that point.
Can anyone advise how to pass property values to the GetCropUrl.
Thanks
Hi Mark,
I'm guessing item is a dynamic object retrieved using CurrrentPage so we will need to cast it, e.g.
<img class="img-responsive" src="@featureImage.GetCropUrl((int)item.imageWidth, 161, furtherOptions:"&filter=comic")" alt="@item.Name"/>
Jeavon
Awesome thanks Jeavon, that did the trick!
Appreciate all your help.
Thanks,
Mark
You're welcome. Could you please mark the above answer as the solution (clicking the green tick)?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Passing node property values to GetCropUrl
Hi,
I have been able to successfully display a cropped image when hard coding the width and height values using the GetCropUrl method as shown below.
However I would like to set this value in the node content and pass them in. For example I have create a property call imageWidth.
Unfortunately I get the following error
In the paragraph tag it does show the property value I have set in the node at that point.
Can anyone advise how to pass property values to the GetCropUrl.
Thanks
Hi Mark,
I'm guessing item is a dynamic object retrieved using CurrrentPage so we will need to cast it, e.g.
Jeavon
Awesome thanks Jeavon, that did the trick!
Appreciate all your help.
Thanks,
Mark
You're welcome. Could you please mark the above answer as the solution (clicking the green tick)?
Thanks,
Jeavon
is working on a reply...