Beispiel #1
0
        private void generate_listing_images(Product product)
        {
            var outputDir    = getOutputDir(getProductDir(product.Id));
            var sourceImages = fileData.GetImagePaths(product);

            foreach (var srcImage in sourceImages)
            {
                Console.WriteLine($"Processing {srcImage}");

                ImageEngine.ResizeImage(srcImage,
                                        outputDir + "/large/" + Path.GetFileName(srcImage),
                                        maxWidth: 1024);

                ImageEngine.ResizeImage(srcImage,
                                        outputDir + "/medium/" + Path.GetFileName(srcImage),
                                        maxWidth: 640);
            }

            // Main product image
            var mainImage = sourceImages[0];

            ImageEngine.ResizeImage(mainImage,
                                    outputDir + "/thumb/thumb.jpg",
                                    maxWidth: 200);

            ImageEngine.ResizeImage(mainImage,
                                    outputDir + "/thumb/product.jpg",
                                    maxWidth: 1024);
        }
Beispiel #2
0
        private IList <ImageDisplayInfo> get_images_for_display(Product product)
        {
            var outputDir = getOutputDir(getProductDir(product.Id));
            var ret       = new List <ImageDisplayInfo>();

            foreach (var path in fileData.GetImagePaths(product))
            {
                var largeImage = outputDir + "/large/" + Path.GetFileName(path);
                var info       = ImageEngine.GetImageMetadata(largeImage);
                ret.Add(new ImageDisplayInfo {
                    Path   = largeImage,
                    Width  = info.width,
                    Height = info.height
                });
            }
            return(ret);
        }