+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Multiple options for thumbnail size for image gallery.

Multiple options for thumbnail size for image gallery.

4 posts, 0 answered
  1. denny
    denny avatar
    13 posts
    Registered:
    16 Oct 2007
    04 May 2013
    Link to this post
    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.
  2. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    08 May 2013
    Link to this post
    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
  3. denny
    denny avatar
    13 posts
    Registered:
    16 Oct 2007
    08 May 2013 in reply to Patrick Dunn
    Link to this post
    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.
  4. Patrick Dunn
    Patrick Dunn avatar
    237 posts
    Registered:
    03 Nov 2014
    09 May 2013
    Link to this post
    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
4 posts, 0 answered