I am working with 7.6 and made a pretty basic Archetype called "Partners" which looks like this...
So a partner is just a name, a logo, and a link. partnerName is a simple text string, partnerLogo is a MediaPicker (with multi items and folder select disabled), and partnerLink is from another of Kevin's awesome projects--
UrlPicker.
My trouble is in getting the image from the media picker while looping through the Archetype. My code is below.
So I'm not sure if this has anything to do with Archetype or if this is just a change in how Media should be returned in 7.6. I've always had success using @Umbraco.Media(string or int) but it seems that no Media method is expecting a Udi.
I've read the little bit of info that I can find but I'm not having much luck. Thanks for any pointers on this.
I know this an extremely late reply, but I came across this thread, and your reply, and thought Id answer your question.
The reason that doesn't work is because without the parenthesis the razor parser will interpret the '<...>' as an html element which means you will be trying to access the getPropertyValue method as a property of the product object and not as a method.
Umbraco 7.6 and Media
Hey everyone!
I am working with 7.6 and made a pretty basic Archetype called "Partners" which looks like this...
So a partner is just a name, a logo, and a link. partnerName is a simple text string, partnerLogo is a MediaPicker (with multi items and folder select disabled), and partnerLink is from another of Kevin's awesome projects-- UrlPicker.
My trouble is in getting the image from the media picker while looping through the Archetype. My code is below.
This does run, but it just outputs
When I pull this out and run it on it's own line
It returns
So I'm not sure if this has anything to do with Archetype or if this is just a change in how Media should be returned in 7.6. I've always had success using @Umbraco.Media(string or int) but it seems that no Media method is expecting a Udi. I've read the little bit of info that I can find but I'm not having much luck. Thanks for any pointers on this.
Thanks
-Roger
Hi Proxicode.
Yes, this is an issue with 7.6 but it is soon solved. Read the comments in this thread: http://issues.umbraco.org/issue/U4-7318
Have a great weekend!
Hi Proxicode,
This is because in v7.6 links to items from pickers(media, content, multinode,...) are not stored as integer id's anymore, but in the new UDI format.
See this topic which had the same issue for the related links datatype : https://our.umbraco.org/forum/templates-partial-views-and-macros//85224-umbraco-76-rc-related-links-umbracowebmodelsrelatedlink-does-not-contain-a-definition-for-link-or-for-isinternal#comment-269795
Luckily the core value convertors package got integrated in the core in v7.6.
https://our.umbraco.org/projects/developer-tools/umbraco-core-property-value-converters/
Now you can do this in your code :
This will return a IPublished content item representing the selected media item.
Dave
Ah thanks a lot Dave! This got me going.
Seems worth mentioning that this this doesn't work...
no errors, builds fine, but nothing displays.
This however DOES work!
Thanks again for taking the time to help me out. Have a good one!
-Roger
Untested but this might work:
Hey Paul - Nice - yeah your solution does work as well!
One of those crazy syntax things that I'm sure has a meaning that I don't understand as to why this doesn't work
but this does
Thanks for chiming in on this :-)
-Roger
I know this an extremely late reply, but I came across this thread, and your reply, and thought Id answer your question.
The reason that doesn't work is because without the parenthesis the razor parser will interpret the '<...>' as an html element which means you will be trying to access the getPropertyValue method as a property of the product object and not as a method.
is working on a reply...