Пример #1
0
        public static void SaveProductImageUseCompress(string destName, Image image, bool skipOriginal = false)
        {
            UpdateDirectories();

            //не удалять, создаем еще один imaga из-за багов в формате файла, если сохранять напрямую, выдает исключение GDI+
            using (Image img = new Bitmap(image))
            {
                if (!skipOriginal)
                {
                    var destPath = FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Original, destName);
                    if (File.Exists(destPath))
                    {
                        DeleteFile(destPath);
                    }
                    img.Save(destPath);
                }

                if (!SettingsCatalog.CompressBigImage)
                {
                    var destPath = FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Big, destName);
                    if (File.Exists(destPath))
                    {
                        DeleteFile(destPath);
                    }
                    img.Save(destPath);
                }

                ModulesRenderer.ProcessPhoto(img);

                if (SettingsCatalog.CompressBigImage)
                {
                    SaveResizePhotoFile(ProductImageType.Big, img, destName);
                }
                SaveResizePhotoFile(ProductImageType.Middle, img, destName);
                SaveResizePhotoFile(ProductImageType.Small, img, destName);
                SaveResizePhotoFile(ProductImageType.XSmall, img, destName);
            }
        }
Пример #2
0
    private void ResizeCurrentPhoto(Image image, string destName)
    {
        FileHelpers.UpdateDirectories();

        ModulesRenderer.ProcessPhoto(image);

        if (SettingsCatalog.CompressBigImage)
        {
            FileHelpers.SaveResizePhotoFile(ProductImageType.Big, image, destName);
        }
        else
        {
            //не удалять, создаем еще один imaga из-за багов в формате файла, если сохранять напрямую, выдает исключение GDI+
            using (Image img = new Bitmap(image))
            {
                img.Save(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Big, destName));
            }
        }

        FileHelpers.SaveResizePhotoFile(ProductImageType.Middle, image, destName);
        FileHelpers.SaveResizePhotoFile(ProductImageType.Small, image, destName);
        FileHelpers.SaveResizePhotoFile(ProductImageType.XSmall, image, destName);
    }
Пример #3
0
        public static void SaveProductImageUseCompress(string destName, Image image, bool skipOriginal = false)
        {
            UpdateDirectories();

            if (!skipOriginal)
            {
                image.Save(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Original, destName));
            }

            ModulesRenderer.ProcessPhoto(image);

            if (SettingsCatalog.CompressBigImage)
            {
                SaveResizePhotoFile(ProductImageType.Big, image, destName);
            }
            else
            {
                image.Save(FoldersHelper.GetImageProductPathAbsolut(ProductImageType.Big, destName));
            }

            SaveResizePhotoFile(ProductImageType.Middle, image, destName);
            SaveResizePhotoFile(ProductImageType.Small, image, destName);
            SaveResizePhotoFile(ProductImageType.XSmall, image, destName);
        }