Multiple options for thumbnail size for image gallery.

Posted by Community Admin on 04-Aug-2018 19:49

Multiple options for thumbnail size for image gallery.

All Replies

Posted by Community Admin on 04-May-2013 00:00
So my client has the need that on page X they use the gallery control and want thumbnails of 150x150 (examples sizes) and on page Y they want it with thumbs of 200x200.

Is this possible?  They keep referencing how the image control has the drop down for these choices, as well as custom.
Posted by Community Admin on 08-May-2013 00:00
Hello Denny,

Thank you for using Sitefinity.

You can expose a public property which will allow it to show up in the backend to be set. You can then use the public property in your widget.

Something like this

using System;
using System.Linq;
using System.Web.UI.WebControls;
using Telerik.Sitefinity.Web.UI;
using Telerik.Sitefinity.Modules.Libraries;
using Telerik.Sitefinity.Modules.Libraries.Web.UI.Images;
 
namespace SitefinityWebApp.Custom
    public class CustomGalleryWithLightBox : Telerik.Sitefinity.Modules.Libraries.Web.UI.Images.MasterThumbnailLightBoxView
    
 
        public int ThumbnailSize get; set;
        protected override void ConfigureDetailLink(System.Web.UI.WebControls.HyperLink singleItemLink, Telerik.Sitefinity.Libraries.Model.Image dataItem, Telerik.Web.UI.RadListViewItem item)
        
            if (ThumbnailSize == null)
                ThumbnailSize = 400;
            singleItemLink.ImageUrl = dataItem.ResolveThumbnailUrl(size: ThumbnailSize);
            singleItemLink.Text = dataItem.AlternativeText;
            singleItemLink.ToolTip = dataItem.Description;
           
        
    

I hope this helps.

Kind regards,
Patrick Dunn
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 08-May-2013 00:00
Nice.  However I can't help but notice this doesn't include the

public override System.Collections.Generic.IEnumerable<ScriptDescriptor>GetScriptDescriptors()
return new[] new ScriptControlDescriptor(typeof(MasterThumbnailLightBoxView).FullName,this.ClientID) ;


fix you posted to my support ticket... if this is a requirement to make these work, perhaps it should be also posted in the examples here so as not to confuse people.
Posted by Community Admin on 09-May-2013 00:00
Hello Denny,

 You're absolutely right. My mistake for forgetting to include it. Anyone reading this post the code Denny posted above is required as well in your solution.

Greetings,
Patrick Dunn
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
This thread is closed