Is the content of your zip actually unpacked to the media-folder? After refreshing the content tree you should be able to see your images in the tree under your album, but they won't appear in the Media section (only in the filesystem).
Which version of Umbraco are you running? And does your Media folder have the correct permissions set?
We're running version v4.0.3. Network Service has been granted full access to the Media folder.
The contents of the zip dont show up in the media folder, and the zip file itself doesnt show up either. I'll check out filemon and see if that sheds any light on the issue.
I think you should give Network Service full permission on the data-folder as well. If I am not mistaken, the zip gets saved there first and after all files are processed, it should be deleted there.
Well, sometime between when I made this post and 10 minutes ago this started working for us. We did system maintenance over the weekend and rebooted this particular box, so that may have had an effect. Thanks for giving us a hand!
Well, I spoke too soon. The problem did not go away. It seems its intermittent.
Also, I found the cause! It seems that the supported image types are CASE SENSITIVE.
The ImageFileTypes in umbracoSetting.config are all lowercase strings. If your images have extensions that are UPPER CASE, then the media elements dont get created and the directory doesnt get deleted, which throws the error.
Solution: There are several... rename your images to use lower case extensions, add upper case extensions to the umbracoSetting.config file, or update Umbraco.RunwayGallery.cs to work with lowercase AND uppercase strings. I'm working on the latter, and will upload my changes once I'm finished.
using System; using System.Collections.Generic; using System.Web; using System.IO; using System.Collections;
using umbraco.interfaces; using umbraco.cms.businesslogic.web; using ICSharpCode.SharpZipLib.Zip; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging;
namespace Umbraco.RunwayGallery { public class ZipUploadHandler : umbraco.BusinessLogic.ApplicationBase { public ZipUploadHandler() { umbraco.content.AfterUpdateDocumentCache += new umbraco.content.DocumentCacheEventHandler(content_AfterUpdateDocumentCache);
// this method contains redundant code from the upload datatype as it's not possible // to access the methods used by the upload datatype to generate thumbnails and update // image sizes
FileInfo imageFile = new FileInfo(filePath); if (umbraco.UmbracoSettings.ImageFileTypes.ToUpper().Contains(imageFile.Extension.ToUpper().Replace(".", ""))) { Document image = Document.MakeNew(umbraco.helper.SpaceCamelCasing(imageFile.Name.Replace(imageFile.Extension, "")), DocumentType.GetByAlias("RunwayGalleryPhoto"), parent.User, parent.Id);
private void generateThumbnail(System.Drawing.Image image, int maxWidthHeight, int fileWidth, int fileHeight, string fullFilePath, string ext, string thumbnailFileName) { // Generate thumbnail float fx = (float)fileWidth / (float)maxWidthHeight; float fy = (float)fileHeight / (float)maxWidthHeight; // must fit in thumbnail size float f = Math.Max(fx, fy); //if (f < 1) f = 1; int widthTh = (int)Math.Round((float)fileWidth / f); int heightTh = (int)Math.Round((float)fileHeight / f);
// fixes for empty width or height if (widthTh == 0) widthTh = 1; if (heightTh == 0) heightTh = 1;
// Create new image with best quality settings
Bitmap bp = new Bitmap(widthTh, heightTh); Graphics g = Graphics.FromImage(bp); g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.PixelOffsetMode = PixelOffsetMode.HighQuality;
// Copy the old image to the new and resized Rectangle rect = new Rectangle(0, 0, widthTh, heightTh); g.DrawImage(image, rect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
// Copy metadata ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders(); ImageCodecInfo codec = null; for (int i = 0; i < codecs.Length; i++) { if (codecs[i].MimeType.Equals("image/jpeg")) codec = codecs[i]; }
// Set compresion ratio to 90% EncoderParameters ep = new EncoderParameters(); ep.Param[0] = new EncoderParameter(Encoder.Quality, 90L);
// Save the new image bp.Save(thumbnailFileName, codec, ep); bp.Dispose(); g.Dispose();
"The directory is not empty." error in Runway Gallery
I've installed the runway gallery and each time I attempt a bulk upload i receive the following error:
The directory is not empty.
The exception is getting thrown at line 41 of Umbraco.RunwayGallery.cs, which reads: Directory.Delete(zipDir);
None of the images from the zip appear to be created as content, and a new, empty directory appears in Media after the error appears.
Has anyone seen this problem before? Is there a known fix? My google-fu gave me this link to the old forums, but as you can see there was no response.
Thanks,
Garrison
Someone? Anyone? Bueller?
I would start by using Filemon (now part of Precess Monitor) and monitor the directory:
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
This will show you where and why the errors are thrown (file locked / permission error etc).
Is the content of your zip actually unpacked to the media-folder? After refreshing the content tree you should be able to see your images in the tree under your album, but they won't appear in the Media section (only in the filesystem).
Which version of Umbraco are you running? And does your Media folder have the correct permissions set?
- Morten
We're running version v4.0.3. Network Service has been granted full access to the Media folder.
The contents of the zip dont show up in the media folder, and the zip file itself doesnt show up either. I'll check out filemon and see if that sheds any light on the issue.
Thanks,
-G
I think you should give Network Service full permission on the data-folder as well. If I am not mistaken, the zip gets saved there first and after all files are processed, it should be deleted there.
HTH,
Peter
Interesting. I'll double-check permissions there as well.
Thanks!
Well, sometime between when I made this post and 10 minutes ago this started working for us. We did system maintenance over the weekend and rebooted this particular box, so that may have had an effect. Thanks for giving us a hand!
Garrison
Well, I spoke too soon. The problem did not go away. It seems its intermittent.
Also, I found the cause! It seems that the supported image types are CASE SENSITIVE.
The ImageFileTypes in umbracoSetting.config are all lowercase strings. If your images have extensions that are UPPER CASE, then the media elements dont get created and the directory doesnt get deleted, which throws the error.
Solution: There are several... rename your images to use lower case extensions, add upper case extensions to the umbracoSetting.config file, or update Umbraco.RunwayGallery.cs to work with lowercase AND uppercase strings. I'm working on the latter, and will upload my changes once I'm finished.
Here you go. This seems to be working for us.
Thank you! Saved me potentially hours trying to work this out.
is working on a reply...