I've got a problem listing the images from the Media directory for my Orchard site.
When trying to add an image using the new media picker I see the list of folders, but when I select one the contents are not listed (see image below).
If I 'import' an image it does appear, but I surely don't need to import every file I'm ever going to use each time, do I?
I must be the only person having this problem because I can't find any reference to it any where else on the web, so thanks in advance.
PS. Sorry if my question isn't perfectly formed - it's my first time posting....
Enable the Update feature and migrate your media to the media library from there. It's a one-time process after which you can use the media library with all your old media.
Ok, I was having this problem as well and just got it fixed. The underlying problem was that there were records in the orchard database for media files that no longer existed. This was because we just changed our project to use Azure storage, and the database was still pointing to images that had been in other areas of our local hard drives. (Orchard was hitting a method to check to see if a blob actually existed while trying to get its public URL, and if it didn't it threw an exception.)
I did two things to fix it. First off, I deleted all of the references to old images from the database. The table [Orchard_MediaLibrary_MediaPartRecord] in the orchard database has all of the filenames. You can check there to see if there are any references to files that you know don't exist.
Secondly, since there are multiple developers working on our CMS, but using a central database, I was worried that it would break again later as we added images to our local azure file systems. I ended up going into the AzureFileSystem.cs file and modifying it to return a blank string instead of throwing an exception if a blob isn't found:
I changed lines 297 and 298 to this:
try
{
Container.EnsureBlobExists(String.Concat(_root, path));
return Container.GetBlockBlobReference(String.Concat(_root, path)).Uri.ToString();
}
catch
{
return "";
}
Now even if it can't find an image it still shows the ones it CAN find.
Hope this helps. You may not be running things through Azure, but you still might be able to delete entries from the database that don't need to be there.