Image width/height setting while creating image in a album

Posted by Community Admin on 04-Aug-2018 12:24

Image width/height setting while creating image in a album

All Replies

Posted by Community Admin on 24-Apr-2014 00:00

 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();

Posted by Community Admin on 28-Apr-2014 00:00

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

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 30-Apr-2014 00:00

Thanks Svetoslav Manchev,

I were looking for the thing within sitefinity. Now will try to resize file prior to saving

This thread is closed