We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Image Galleries using nGen File Field, FF Matrix and Imgsizer

Development and Programming

goodcompany's avatar
goodcompany
51 posts
16 years ago
goodcompany's avatar goodcompany

Simple question regarding the building of an image gallery using these great extensions, together with the Imgsizer plugin.

Basically I am looking for the best way to parse the rows from an FF Matrix containing the nGen File Field, so that the first image can be styled or handled differently from any additional images. An obvious thing to want to do, with a probably obvious solution that I can’t puzzle out.

I’ve wrestled with several ideas and solutions, but none of them seem to stick. If an offset tag was available to {my-ffmatrix-gallery-field} it would be easier, but as it is I can’t find a good method for applying a different image size to the first image from the FF matrix.

I was inclined to use an if/else with row_count, but I’m not getting the result I want. Can anyone give me a hint?

       
goodcompany's avatar
goodcompany
51 posts
16 years ago
goodcompany's avatar goodcompany

This is by the way something close to what I’d like to do, which obviously doesn’t work for lack of an offset param…and perhaps many other reasons.

{exp:weblog:entries weblog="{my_weblog}" limit="1" category="{my_category}" orderby="date" sort="desc" disable="member_data|trackbacks" status="open|featured"}

    {if images}
        {images limit="1"}
            {exp:imgsizer:size src="{image_path}" width="500"}
            <a href="http://{sized}" title="{title}" class="gallery-image">{exp:imgsizer:size src="{image_path}" width="550" alt="{title}" id="image_{entry_id}" class="entry_img"}</a><br>
            {/exp:imgsizer:size}
        {/images}

        {if images:total_rows > 1}
            {images offset="1"}
                {exp:imgsizer:size src="{image_path}" width="50" height="50"}
                <a href="http://{sized}" title="{title}" class="gallery-image">{exp:imgsizer:size src="{image_path}" height="150" alt="{title}" id="image_{entry_id}" class="entry_img"}</a>
                {/exp:imgsizer:size}
            {/images}
        {/if}
    {/if}

{/exp:weblog:entries}
       
International Polar Foundation's avatar
International Polar Foundation
14 posts
16 years ago
International Polar Foundation's avatar International Polar Foundation

Can you please explain why {row_count} didn’t work ? The simplest solution for me seems to use that. If {row_count} == 1, dispay the large image and otherwise, display the small images.

{exp:weblog:entries weblog="{my_weblog}" limit="1" category="{my_category}" orderby="date" sort="desc" disable="member_data|trackbacks" status="open|featured"}

{images}
    {if {row_count} == 1}
        {exp:imgsizer:size src="{image_path}" width="500" alt=""}
    {if:else}
        {exp:imgsizer:size src="{image_path}" width="50" height="50" alt=""}
    {/if}
{/images}

{/exp:weblog:entries}

Have not tested it but I think it should work.

       
goodcompany's avatar
goodcompany
51 posts
16 years ago
goodcompany's avatar goodcompany

I’m an idiot who thanks you. I tried something similar several times but couldn’t make it work - probably for mismatched imgsizer tags or something else ridiculous. This is exactly the way you would hope to do it, and it works. Of course.

Thanks!

       
International Polar Foundation's avatar
International Polar Foundation
14 posts
16 years ago
International Polar Foundation's avatar International Polar Foundation

Glad it worked ! There are no idiots, only people learning ;o) I got so much help from these forums, I am glad I can contribute in my own small way.

       
Clearpeak's avatar
Clearpeak
413 posts
16 years ago
Clearpeak's avatar Clearpeak

Hi,

I’m also trying to build an image gallery using Ngen File field and FFmatrix. I can see how you could easily generate your table of thumbnails using the FFmatrix tag pair. What I can seem to figure out is how to do a prev/next button once you are on the photo detail page. So if you clicked on a thumbnail and it took you to the full size image how would you then be taken to the next or previous image in the loop? Could this be done with the {row_count} also?

Like {if {row_count} == +1} Next {/if}

Any ideas?

Thanks so much.

       
Jérôme Coupé's avatar
Jérôme Coupé
122 posts
16 years ago
Jérôme Coupé's avatar Jérôme Coupé

@fdoney

Here is how I did previous and next links with another setup for picture galleries (still using the same plugins/extensions. You could certainly make it work your way. See the code I posted in this thread.

HTH

       
Clearpeak's avatar
Clearpeak
413 posts
16 years ago
Clearpeak's avatar Clearpeak

Thanks a lot g-rom. I’ll give it a try.

       
Clearpeak's avatar
Clearpeak
413 posts
16 years ago
Clearpeak's avatar Clearpeak

g-rom,

Thanks so much!. Your active picture code works perfectly for me.

Best,

Fod

       
Clearpeak's avatar
Clearpeak
413 posts
16 years ago
Clearpeak's avatar Clearpeak

Hi g-rom,

I’m having the same problem as Steve Hurst here:

http://ellislab.com/forums/viewthread/108082/P36/#562110

The {row_count} seems to equal the individual cell count and the {total_rows} variable seems to indicate just the total number of rows and not all the individual cells.

So I’m using FF matrix with two columns and my {row_count} goes up to 8 on one entry but my {total_rows} is only 4. This is making my previous/next buttons not work because my activepicture row count is indicated as more than my total rows so the next button doesn’t show when it should in the conditional statement.

Have you run into this?

Thanks

       
Clearpeak's avatar
Clearpeak
413 posts
16 years ago
Clearpeak's avatar Clearpeak

Sorry to keep bugging you g-rom. I upgraded to fieldframe 1.1.2 and that fixed the {row_count} issue.

One more issue I’m having:

The photo in my fourth ffmatrix row is not displaying. Every other photo shows up fine. Do you think this might have to do with:

fetch_uri_segment(‘4’);

in the PHP? Could there be some kind of conflict happening with the 4’s?

Thanks again.

       
Jérôme Coupé's avatar
Jérôme Coupé
122 posts
16 years ago
Jérôme Coupé's avatar Jérôme Coupé

Hello fdoney,

Had the {row_count} issue as well. Quickly fixed though.

As for the secondissue you describe, I have not run into this myself. I cannot see how the PHP could impact that. It’s parsed before the rest of the code and only fetches a URL segment … strange …

Have you tried to display / echo the various values to see what happens when the fourth image should be displayed ?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.