Plugin

Archived
Forum
(read-only)

String

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From eMarketSouth

     

Would this be possible?

General

smartpill
smartpill

I’m making a grid of entries 2 across. Each entry has a single image on top but the heights vary. The designer wants to bottom-align the images so in order to do that I need to add padding to the top of the shorter image to compensate.

To do this dynamically, I would need to grab the height of each image from every pair of entries (1 and 2, 3 and 4, 5 and 6, etc.), compare the heights (I can get height using the CE Image plugin) and pass that value of the larger height to an embed so that the Math Plus plugin can calculate the difference and output that value as padding to the top of the shorter image so that they align on the bottom.

I can do it with a set height for all images but would ideally like to grab an actual height for each pair.

Do you have any idea if this is doable with the String plugin or is this crazy-talk?

eMarketSouth
# 1
Developer
eMarketSouth

Hello Smartpill,

Have you considered using CSS or HTML Tables to line up your images?  It would make your templates a lot simpler and easier to maintain.

The process you describe should work; you can pass two pictures and a maximum height to an embed file and let it handle the padding.  It might be better to pass your arguments directly through the {embed} tag to avoid parsing order strangeness.  You could also use embedded PHP to handle padding if you’re comfortable writing code.

Sincerely,
Jack Scott