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:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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