Ejemplo n.º 1
0
        /// <summary>
        /// using the given image url, create all image sizes and upload images to cloud
        /// usually done on a separate thread
        /// </summary>
        /// <param name="imagePath">relative file path of image</param>
        public static void UploadImageSizes(string imagePath)
        {
            // go through all image sizes
            var cloudfile = new CloudFile(Constants.RACKSPACE_CONTAINER_IMAGES);

            foreach (Imgsize values in Enum.GetValues(typeof(Imgsize)))
            {
                var thumbnailPath = Img.by_size(imagePath, values, true);

                if (string.IsNullOrEmpty(thumbnailPath))
                {
                    Syslog.Write("Image not found:" + imagePath);
                    continue;
                }

                // save various image sizes to cloud
                cloudfile.AddBlobItemAsync(Constants.PHOTO_SOURCE_DIRECTORY + thumbnailPath);
            }
            // save original image to cloud
            cloudfile.AddBlobItemAsync(Constants.PHOTO_SOURCE_DIRECTORY + imagePath);
        }