Esempio n. 1
0
        /// <summary>If this ProductImage has an Image then save the Image to the file system.</summary>
        private void SaveImageFile(ProductImage pi, System.Drawing.Image resized, ProductImage.SizeOption size)
        {
            if (!Directory.Exists(pi.Product.MetaProduct.Agency.ContentDirectory))
                Directory.CreateDirectory(pi.Product.MetaProduct.Agency.ContentDirectory);

            Contract.Assert(resized != null, "Image file save failed because Image is null.");
            resized.Save(pi.GetFullyQualifiedFileName(size), System.Drawing.Imaging.ImageFormat.Jpeg);
            resized.Dispose();
        }
Esempio n. 2
0
 private void DeleteProductImageFiles(ProductImage image)
 {
     if (File.Exists(image.GetFullyQualifiedFileName(ProductImage.SizeOption.SMALL)))
         File.Delete(image.GetFullyQualifiedFileName(ProductImage.SizeOption.SMALL));
     if (File.Exists(image.GetFullyQualifiedFileName(ProductImage.SizeOption.LARGE)))
         File.Delete(image.GetFullyQualifiedFileName(ProductImage.SizeOption.LARGE));
 }