Multiple options for thumbnail size for image gallery.
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.
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;
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) ;
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,