If title and caption, then display in this cell size, otherwise [option b] If title and caption, then display in this cell size, otherwise [option b]
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

If title and caption, then display in this cell size, otherwise [option b]

Started by wayfarer, November 12, 2004, 08:43:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wayfarer

I have modified the intermediate image display so that the title and caption display to the right of the image instead of below. To avoid a long caption taking up too much horizontal space (as it does if I set the title and caption containing cell width to auto), I have made the containing cell 200 pixels wide. If however, there is no title or caption, the image will naturally display slightly offset to the left, instead of dead center, because the 200 pixels width is pushing the image to the left.

Is there a modification I can do so that Coppermine looks to see if there is a title and/or caption and uses the 200 pixels width in the case of the affirmative and if there is no title or caption, then it regards the cell width as auto? So that when there is no title or caption, the image will display in the center of the parent table?

Kind of like an "if this, then that" "but if not, then this instead" scenario...

Here is the relevant code from my theme.php page:

// HTML template for intermediate image display
$template_display_picture = <<<EOT
        <tr>
                <td align="center" class="blacktable" height="{CELL_HEIGHT}" style="white-space: nowrap; padding: 0px;">
                        <table cellspacing="2" cellpadding="0" class="imageborder">
                                <tr>
<td align="center" valign="top">
                                                {IMAGE}
                                                {ADMIN_MENU}
                                        </td>
<td align="left" valign="top" width="200">
<p></p>
<!-- BEGIN img_desc -->
<table width="100%" cellpadding="5" cellspacing="0" class="altimagecaption">
<!-- BEGIN title -->
<tr>
<th align="left">
                                                {TITLE}
                                        </th>
</tr>
<!-- END title --><!-- BEGIN caption -->
<tr>
<td align="left">
                                                {CAPTION}
                                        </td>
</tr>
<!-- END caption -->
</table>
<!-- END img_desc --></td>
</tr>
                        </table>                </td>
        </tr>


Joachim Müller

don't use fixed (pixel-based) table widths, instead use the css attribute "overflow".

Joachim

wayfarer

Ok... I haven't used that attribute before. Just did a bit of research on it. So:

"The overflow declaration tells the browser what to do with content that doesn't fit in a box." And there are several ways the overrun can be handled: visible, scroll, auto and hidden.

But if there is no box size defined, how can content be deemed to have overrun it? And this still wouldn't resolve the image displaying off center when there is no title or caption would it?  ???

wayfarer

Hang on, I've got it working  ;D That is a very beautiful thing. Thanks heaps.

stock

Joachim, I wonder if you can help.

I tried Wayfarer's code and it does exactly what I want, however, if the caption is long, this forces the box to the right, overlapping the menu. How can one restrict it to have the text on as many lines as needed? See http://www.stockshoots.co.uk/displayimage.php?album=70&pos=4 (if you need to log in, sorry, I can do a screen image to show you).

Thanks very much

Stock