File information Table Width in Displayimage.php File information Table Width in Displayimage.php
 

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

File information Table Width in Displayimage.php

Started by tibu, May 13, 2006, 10:29:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tibu

I have been searching this board and looking in the code, but can't figure out:

On displayimage.php there is a table called "File Information". I want to decrease the width (or percentage of table used) of the column on the left that contains the field titles. Right now it appears to be a 50/50 split. Is there somwhere to define the % of table width used? I found it for login.php but am not finding anything similar for this page.

Nibbler

It's here in the theme system


function theme_html_picinfo(&$info)
{
    global $lang_picinfo;

    $html = '';

    $html .= "        <tr><td colspan=\"2\" class=\"tableh2_compact\"><b>{$lang_picinfo['title']}</b></td></tr>\n";
    $template = "        <tr><td class=\"tableb_compact\" valign=\"top\" >%s:</td><td class=\"tableb_compact\">%s</td></tr>\n";
    foreach ($info as $key => $value) $html .= sprintf($template, $key, $value);

    return $html;
}

tibu

I thought it had something to do with that, and I pasted that into my theme.php file. I guess I am not sure what exactly to change in that code to define the width. I guess I need to learn more about html/php before I can accomplish what I want. Thanks for pointing me in the right direction.
However, If someone knows and can code an example in what Nibbler posted I certainly would be appreciative.

Nibbler

Set the td widths like this


function theme_html_picinfo(&$info)
{
    global $lang_picinfo;

    $html = '';

    $html .= "        <tr><td colspan=\"2\" class=\"tableh2_compact\"><b>{$lang_picinfo['title']}</b></td></tr>\n";
    $template = "        <tr><td class=\"tableb_compact\" valign=\"top\" width=\"40%\">%s:</td><td class=\"tableb_compact\" width=\"60%\">%s</td></tr>\n";
    foreach ($info as $key => $value) $html .= sprintf($template, $key, $value);

    return $html;
}


I've not tested it but it should work.

tibu

Thanks. I tried as suggested and tested and the results was the table did not display. The "File Information" heading was there, but the two columns of fields were not. I also tried it (just to test) in themes.inc.php, pasting the code exactly as you had it. Still, nothing. I have a hack that when you click on the filename, it allows you to download. Maybe that is conflicting (???).

Thanks again for the suggestion, however, it appears that some other hack I have done must be conflicting.

Joachim Müller

don't edit themes.inc.php, under no circumstances!

dereksurfs

I just figured out how to make this work so I thought I would share my code. 

First I added the function theme_html_picinfo to my local theme.php file.  Then I changed the code like this:

function theme_html_picinfo(&$info)
{
    global $lang_picinfo;

    $html = '';

    $html .= "        <tr><td colspan=\"2\" class=\"tableh2_compact\"><b>{$lang_picinfo['title']}</b></td></tr>\n";
    $template = "        <tr><td class=\"tableb_compact\" valign=\"top\" align=\"right\" width=\"50%%\">%s:</td><td class=\"tableb_compact\" align=\"left\" >%s</td></tr>\n";
    foreach ($info as $key => $value) $html .= sprintf($template, $key, $value);

    return $html;
}


Note that the percent sign (%) is a special character in PHP.  So to use it in this context you need to write %%.  See the code above for example. 

Now my EXIF data is center aligned and much more readable IMHO.  You can see an example here:
http://www.lightquestphoto.com/coppermine/displayimage.php?album=1&pos=0

I also removed some extra info I didn't want which wouldn't go away with the EXIF Manager.  I had to edit the displayimage.php for that.

- Derek