I am getting an error "Cannot implicitly convert type 'Umbraco.Web.Models.DynamicPublishedContent' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?)"
As you can see on first picture, Main Picture points "Sand" folder and Main Thumbnail points "Thumbnail" folder. Links gets the Sand folder in the following and display but How can I image source to point out the Thumbnail folder in this case?
<a href="@photo.UmbracoFile">
var MediaFolder2 = Umbraco.Media(childPage.mainThumbnail);
foreach (var photo2 in MediaFolder2.Children){
<img src="@photo2.UmbracoFile" alt="">
}
</a>
No, the thing is that image tag should point "Thumbnail" folder and link should point "Sand" folder or should I try different approach? What would you say?
The you could use the image cropper or if exactly the same just a resize querystring, e.g. /media/1000/mainImage.jpg?width=50&height=50 (more options here) Then you would not need the thumbnail picker at all!
Iterate through Media Folder
Hi all,
I have a document type containg "mainPicture" and "thumbnailOfPicture" properties using Media Picker as shown in the following.
Those properties either select a thumbnail or a media folder from Media Section as shown again in the following.
What I could achieve is that to display a thumbnail but I could not make it display images of selected folder on mainPicture property.
What I have done so far ;
Lastly for displaying lots of photos, is there any project to make it simplier?
Any help much appreciated.
Hi,
You just a tiny mistake of a lowercase umbraco which should be Umbraco
You could consider the new Nested Content package for this
Jeavon
Hi Jeavon,
I am getting an error "Cannot implicitly convert type 'Umbraco.Web.Models.DynamicPublishedContent' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?)"
on line; foreach (var photo in MediaFolder){
You will need .Children, e.g.
Hi again Jeavon,
Based on your suggestion, I can display the page but it returns nothing in the following;
Hello, give this a try:
I get the error
Exception Details: System.NotSupportedException: Cannot resolve a Url for a media item when there is no 'umbracoFile' property defined.
Oh, so what is the name of the upload or imagecropper property on the media items that are children of the folder selected in "Main Picture"?
I hope I understood you correctly. Is that what you want to see in the following.
In your screen shot you showed a folder called "Sand" selected in "Main Picture", what Children does "Sand" have and what properties do they have?
I found the wrong section because of the nested folders on media section.
but this time I faced with another problem which I hope you put me in right direction.
I changed doc type and code a bit
As you can see on first picture, Main Picture points "Sand" folder and Main Thumbnail points "Thumbnail" folder. Links gets the Sand folder in the following and display but How can I image source to point out the Thumbnail folder in this case?
Like this?
Hi Jeavon,
I get the following output but it must be one image for every link.
So you would like only the first one from that folder?
I should display every picture in that folder for example.
It should look like above and iterate through every image
Ok, so it should be like this then?
No, the thing is that image tag should point "Thumbnail" folder and link should point "Sand" folder or should I try different approach? What would you say?
How would it link the "Sand" folder, as it contains many images?
Could you illustrate how the markup should be and I can work from that?
Also to clarify, "mainThumbnail" is a single image and "mainPicture" is the folder "Sand" containing many images etc...?
I think for your first two questions, I should think different approach. What would you suggest?
For the third question, mainThumbnail contains also many images.Every image has its thumbnail so if nine images of Sand, it should also 9 thumbnails.
Is the thumbnail always a scaled version of the main image?
yes, it is.
The you could use the image cropper or if exactly the same just a resize querystring, e.g.
/media/1000/mainImage.jpg?width=50&height=50
(more options here) Then you would not need the thumbnail picker at all!Hi Jeavon,
Sorry for the late answer. I have fallen ill. I will try your suggestion.
By the way, let's think I have a following structure
On Level1, How can I itearate through so only the first item of the sublevels selected?
is working on a reply...