Alexander Haneng
Jun 29, 2011
(2 votes)

Using EPiImage with Page Type Builder (PTB)

I have gotten a few questions about how to use EPiImage with PTB. So in this blog post I thought I would cover the basics.


People have been using EPiImage with PTB almost since the start of EPiImage, but with the new 2.5 version it is even easier.



Adding a EPiImageProperty to a PageType:

[PageTypeProperty(EditCaption = "Main image", Type = typeof(EPiImageProperty))]
public virtual EPiImagePropertyData MainImage
    get; set;


You can access the property directly:

Image url: <%=CurrentPage.MainImage.ImageUrl%>
Image description: <%=CurrentPage.MainImage.ImageDescription%>


Or use it with EPiImageResizer:

<%@ Register TagPrefix="EPiImage" TagName="EPiImageResizer" 
    Src="~/EPiImage/UserControls/EPiImageResizer.ascx" %>
<EPiImage:EPiImageResizer ID="Image" 
    Transformation="ScaleToFit" runat="server" />



Adding a EPiImageGalleryProperty to a PageType:

[PageTypeProperty(EditCaption = "Image gallery", Type = typeof(EPiImageGalleryProperty))]
public virtual EPiImageGalleryImageCollection ImageGallery


You can access the property directly:

foreach (EPiImageGalleryImage Image in CurrentPage.ImageGallery)
  Image Url: <%= Image.ImageURL %><br />
  Link Url: <%= Image.LinkURL %><br />
  Description: <%= Image.Description %><br />


Or using EPiImageGalleryViewer:

<%@ Register TagPrefix="EPiImage" 
<EPiImage:EPiImageGalleryViewer ID="Viewer"
    runat="server" />


Or using EPiImageGalleryGrid:

<%@ Register TagPrefix="EPiImage" 
    Src="~/EPiImage/UserControls/EPiImageGalleryGrid.ascx" %>
<EPiImage:EPiImageGalleryGrid ID="Grid" 
    ThumbnailHeight="150" ThumbnailWidth="150" 
    DescriptionHeight="20" DownloadLinkHeight="20" 
    LinkThumbnailsTo="OriginalImage" runat="server" />


Download EPiImage

For more information about EPiImage and to download the module visit the EPiImage EPiCode page.



Posted by

Jun 29, 2011


Please login to comment.
Latest blogs
Content Delivery API – The Case of the Duplicate API Refresh Token

Creating a custom refresh provider to resolve the issues with duplicate tokens in the DXC The post Content Delivery API – The Case of the Duplicate...

David Lewis | Sep 29, 2022 | Syndicated blog

New Optimizely certifications - register for beta testing before November 1st

In January 2023, Optimizely is making updates to the current versions of our certification exams to make sure that each exam covers the necessary...

Jamilia Buzurukova | Sep 28, 2022

Optimizely community meetup - Sept 29 (virtual + Melbourne)

Super excited to be presenting this Thursday the 29th of September at the Optimizely community meetup. For the full details and RSVP's see the...

Ynze | Sep 27, 2022 | Syndicated blog

Preview multiple Visitor Groups directly while browsing your Optimizely site

Visitor groups are great - it's an easy way to add personalization towards market segments to your site. But it does come with it's own set of...

Allan Thraen | Sep 26, 2022 | Syndicated blog