Try our conversational search powered by Generative AI!

Alexander Haneng
Jun 29, 2011
  4256
(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.

 

EPiImageProperty

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" 
    PropertyName="MainImage" 
    Width="200" 
    Height="200" 
    Transformation="ScaleToFit" runat="server" />

 

EPiImageGalleryProperty

Adding a EPiImageGalleryProperty to a PageType:

[PageTypeProperty(EditCaption = "Image gallery", Type = typeof(EPiImageGalleryProperty))]
public virtual EPiImageGalleryImageCollection ImageGallery
{
    get;
    set;
}

 

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" 
   TagName="EPiImageGalleryViewer" 
   Src="~/EPiImage/UserControls/EPiImageGalleryViewer.ascx"%>
 
<EPiImage:EPiImageGalleryViewer ID="Viewer"
    PropertyName="ImageGallery" 
    runat="server" />

 

Or using EPiImageGalleryGrid:

<%@ Register TagPrefix="EPiImage" 
    TagName="EPiImageGalleryGrid" 
    Src="~/EPiImage/UserControls/EPiImageGalleryGrid.ascx" %>
 
<EPiImage:EPiImageGalleryGrid ID="Grid" 
    PropertyName="ImageGallery" 
    ThumbnailHeight="150" ThumbnailWidth="150" 
    DescriptionHeight="20" DownloadLinkHeight="20" 
    Transformation="ScaleToFill" 
    ShowDescription="true" 
    ShowDownloadLink="true" 
    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

Comments

Please login to comment.
Latest blogs
Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog