<!-- Enables value converters for all built in property editors so that they return strongly typed object, recommended for use with Models Builder -->
<EnablePropertyValueConverters>true</EnablePropertyValueConverters>
When I used :
var productImage = Umbraco.AssignedContentItem.GetPropertyValue("uploadBanner");
I got the value of the image :) : <img src="/media/1001/afrasia-woman-tablet.jpg">
I think we're supposed to use Umbraco.Media() instead of Umbraco.Content() but aside from that I wonder is there an issue because of the core property value converters returning an ImageCropDataSet as opposed to an IPublishedContent which the extension method for GetResponsiveCropUrl() expects.
I am using a media picker now . But still the code does not work it gives me the error below :
`Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Umbraco.Web.PublishedContentModels.Slider' does not contain a definition for 'GetResponsiveCropUrl'`
Using slimsy
Hello,
I am using slimsy and below is my code :
'var productImage = Umbraco.Content(CurrentPage.uploadBanner);
large is my crop name.
But the image is not appearing.
Can someone please advise what I am doing wrong.
Thanks,
kusum
Hi Kusum
Can you check "productImage" on null"? Can you debug and check what is in "productImage" variable?
Alex
Hello Alex,
Thanks for our reply .
When using :
I get null value for productImage.
But when I use :
I get the image. But I do not know how to use "GetResponsiveCropUrl" on "CurrentPage.uploadBanner".
Please let me know If I am not clear.
Thanks,
kusum
What about this code:
Tried this as well. not working.
What about this one:
got the below as error :
Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: mediaItem
But When I do CurrentPage.uploadBanner , I do get a value
CurrentPage.uploadBanner - isn't perfect way to get image now, it's dynamic, and it's not recommended
What is returning with this code : Umbraco.AssignedContentItem.GetPropertyValue
When I try to get the value from :
I get nothing.
And this one?
var productImage = Umbraco.AssignedContentItem.GetPropertyValue("uploadBanner");
Are Property Value Converters enabled?
Umbraco 7.6?
Are Property Value Converters enabled? - yes
When I used :
I got the value of the image :) :
<img src="/media/1001/afrasia-woman-tablet.jpg">
Hi Kusum
What type of picker do you have on the page?
Alex
I have used image cropper : Homepage - Upload banner - Image Cropper
Should I use a media picker ?
I think we're supposed to use Umbraco.Media() instead of Umbraco.Content() but aside from that I wonder is there an issue because of the core property value converters returning an ImageCropDataSet as opposed to an IPublishedContent which the extension method for GetResponsiveCropUrl() expects.
Hello,
I am using a media picker now . But still the code does not work it gives me the error below :
I have used :
Hi Kusum
Show all your code, please.
Thanks,
Alex
is working on a reply...