Correct, get's me started but I don't want to show all files and folders immediately. So just the folders at the root, when a visitor clicks on one of the folders you should go to a page (/folder-name) with all the files/folders.
How can I generate these pages? When I do "@media.Url", the value is empty...
This takes care of displaying all the images in the main folder and the folders in the main folder. My question is, how do I get the specific URL for a folder that's in the main folder. With "@item.Url" I get a URL but this gives me a 404. At this page I should display the images in that folder... So a typical gallery with albums.
The way I think you should go to is using querystrings.
So when you render your images and folder you can set the folder with a hyperlink where you add a link to the current page but with a querystring which contains the foldername.
Where Model.Content.Url is the url of the current page where you load the media library and the item.Id will be the Id of the media folder.
Make sure to add a check to see if its a folder or not in your foreach statement.
After that you can collect the folder by using Request.Querystring["folder"], also bear in mind to do some checks in order to load the main folder contents or the contents for the given folder in the url.
Media library
Hi,
Does anyone has experience with a media library? It should be a page that renders all the folders and files from the “Media” sectio’s.
Every directory has a name and files.
Any ideas?
Kind regards,
Benoit
Hi
Look please at this topic - https://our.umbraco.org/forum/templates-partial-views-and-macros/87221-list-all-media-items-from-media-library#comment-276563
There is a solution for your task.
Thanks,
Alex
Hi Alex,
Correct, get's me started but I don't want to show all files and folders immediately. So just the folders at the root, when a visitor clicks on one of the folders you should go to a page (/folder-name) with all the files/folders. How can I generate these pages? When I do "@media.Url", the value is empty...
Kind regards,
Benoit
Hi,
So this is my code at the moment:
This takes care of displaying all the images in the main folder and the folders in the main folder. My question is, how do I get the specific URL for a folder that's in the main folder. With "@item.Url" I get a URL but this gives me a 404. At this page I should display the images in that folder... So a typical gallery with albums.
Any help? Stuck on this for a week...
Kind regards,
Benoit
Hi Benoit,
The way I think you should go to is using querystrings.
So when you render your images and folder you can set the folder with a hyperlink where you add a link to the current page but with a querystring which contains the foldername.
Like for example:
Where
Model.Content.Url
is the url of the current page where you load the media library and theitem.Id
will be the Id of the media folder.Make sure to add a check to see if its a folder or not in your foreach statement.
After that you can collect the folder by using
Request.Querystring["folder"]
, also bear in mind to do some checks in order to load the main folder contents or the contents for the given folder in the url.Hope this helps.
Have a nice day
/Michaël
is working on a reply...