if ((tempExtension == "jpg") || (tempExtension == "jpeg") || (tempExtension == "gif") || (tempExtension == "png")) { int imageHeight = Convert.ToInt32(sender.getProperty("umbracoHeight").Value); int imageWidth = Convert.ToInt32(sender.getProperty("umbracoWidth").Value);
//Remove the first slash from the path. imageFile = imageFile.Remove(0, 1);
//Get the server path. string serverPath = HttpContext.Current.Server.MapPath("~"); int imageSelection = Convert.ToInt32(sender.getProperty("imageType").Value);
//Get some strings needed for building the paths. string fileName = Path.GetFileName(imageFile); string extension = Path.GetExtension(imageFile); string shortFileName = fileName.Replace(extension, string.Empty); string mediaPath = imageFile.Substring(0, imageFile.LastIndexOf("/"));
internal static string ResizeImage(string imageUrl, int maxHeight, int maxWidth, bool isThumbnail, int type) { if (imageUrl == String.Empty) return String.Empty;
var origUrl = imageUrl; var origFile = origUrl;
// Get height and width var height = maxHeight; var width = maxWidth;
// get orig info var origFileNameWithoutExtension = Path.GetFileNameWithoutExtension(origFile); var origFileNameWithExtension = Path.GetFileName(origFile); var origExtension = Path.GetExtension(origFile);
// build new file name var newFileName = String.Format("{0}_{1}{2}", origFileNameWithoutExtension, "thumb", origExtension); var newFile = origFile.Replace(origFileNameWithExtension, newFileName);
private static void ResizeOrigImage(string origFile, int maxWidth, int maxHeight, int type) { if (type != 1) { var fullSizeImage = Image.FromFile(origFile);
// Ensure the generated thumbnail is not being used by rotating it 360 degrees fullSizeImage.RotateFlip(RotateFlipType.Rotate180FlipNone); fullSizeImage.RotateFlip(RotateFlipType.Rotate180FlipNone);
But I will need to resize also the thumbnail as the current thumbnail of umbraco is smaller than what we need. I'm just wondering why my code is not working considering that it is almost the same as waffel's code.
Overriding the application base to resize image
I'm using the ff method to resize the image
But I noticed that the image is not resizing properly. Can anyone tell if this is not supported in the new version of umbraco 4.7 and 4.11
do you know Waffel? - http://our.umbraco.org/projects/developer-tools/waffel-autocompress
But I will need to resize also the thumbnail as the current thumbnail of umbraco is smaller than what we need. I'm just wondering why my code is not working considering that it is almost the same as waffel's code.
don't know, personally i wouldn't use a code solution but simply use imageGen for generating resizes of any dimensions ? :)
is working on a reply...