Advanced search  

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]

Pages: [1]   Go Down

Author Topic: If title and caption, then display in this cell size, otherwise [option b]  (Read 4216 times)

0 Members and 1 Guest are viewing this topic.

wayfarer

  • Coppermine newbie
  • Offline Offline
  • Posts: 15

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:

Code: [Select]
// 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>

« Last Edit: November 12, 2004, 10:14:55 am by TranzNDance »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: If title and caption, then display in this cell size, otherwise [option b]
« Reply #1 on: November 12, 2004, 08:50:42 am »

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

Joachim
Logged

wayfarer

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: If title and caption, then display in this cell size, otherwise [option b]
« Reply #2 on: November 12, 2004, 09:21:38 am »

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?  ???
Logged

wayfarer

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: If title and caption, then display in this cell size, otherwise [option b]
« Reply #3 on: November 12, 2004, 10:02:25 am »

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

stock

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 109
Re: captio
« Reply #4 on: August 21, 2005, 02:56:50 pm »

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
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 20 queries.