Image width/height setting while creating image in a album
I am using following code to upload an image in a album. what i wan't is that the width and height of the image setting should be in my control. I have tried newVid.Width = mywidth; and newVid.Height = myheight but image remain same. any idea what change i do in following code to achieve it
Telerik.Sitefinity.Libraries.Model.Album album = App.WorkWith().Albums().Where(i => i.Title == albumName).Get().FirstOrDefault() ?? App.WorkWith().Albums().Get().FirstOrDefault(); LibrariesManager libManager = LibrariesManager.GetManager(); libManager.Provider.SuppressSecurityChecks = true; Telerik.Sitefinity.Libraries.Model.Image newVid = libManager.CreateImage(); newVid.Parent = libManager.GetAlbum(album.Id); //newVid.Title = imageTitle; Guid imageId = newVid.Id; newVid.Title = imageTitle; newVid.DateCreated = DateTime.UtcNow; newVid.PublicationDate = DateTime.UtcNow; newVid.LastModified = DateTime.UtcNow; newVid.Urls.Clear(); //newVid.UrlName = Regex.Replace(imageTitle.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-"); ; newVid.UrlName = Regex.Replace(imageId.ToString(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-"); libManager.Upload(newVid, imageStream, imageExtension); libManager.RecompileItemUrls(newVid); libManager.Lifecycle.Publish(newVid); libManager.SaveChanges();Hi Kamran,
You could try to resize the image in the Stream before uploading it.
I hope the examples here and here are helpful.
Regards,
Svetoslav Manchev
Telerik
Thanks Svetoslav Manchev,
I were looking for the thing within sitefinity. Now will try to resize file prior to saving