tips icon image

EE Insider Tips
Sponsored by EE Screencasts

ExpressionEngine mini-howtos created by the EE Insider community.

Cover Image with FF matrix gallery

User's avatar
  • Posted by Sean Smith
  • November 07, 2009
  • 1 person has found this tip helpful.

Making a gallery using FF Matrix and Ngen file field is a very popular way to make a gallery. I made a gallery like this but wanted to pull one image from each gallery into the sidebar and also using the same image as a post image in a news item.

Now the client can change the cover photo easily without having to reorder the matrix.

To ensure that the image pulled was the same one and chosen by the client I added a checkbox to the matrix. and then used the following code.

Sidebar Gallery

{exp:weblog:entries weblog="gallery" dynamic="off" limit="9 orderby="random" disable="trackback|member_data|comments"}
        {gallery}
            {if cover}
                {exp:imgsizer:size src="
{photo}" width="73" height="73"}
                    <a href="
{title_permalink=photos/gallery"}"><img src="{sized}" width="{width}" height="{height}" alt="{caption}" /></a>
                
{/exp:imgsizer:size}
            {
/if}
        {
/gallery} 
    {
/exp:weblog:entries} 

and using related entry on the news page

{related_entries id="gallery_relationship"}
    {gallery}
        {if cover}
            {exp
:imgsizer:size src="{photo}" width="550" height="300"}
                
<img src="{sized}" width="{width}" height="{height}" alt="{caption}" class="newsBgThumb" />
            
{/exp:imgsizer:size}
        {
/if}
    {
/gallery}  
{
/related_entries} 

Add Your Comment?

You must have an EE Insider account to post comments on Insider Tips. It's fast, easy and hassle-free.

Sign up now (or login).

Search EE Insider Tips
Sponsored By