Changing ALT tags for thumbnails Changing ALT tags for thumbnails
 

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

Changing ALT tags for thumbnails

Started by 2002, June 08, 2007, 06:43:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

2002

Hi,

I was previewing my gallery on my website and I've noticed that when I hover over the thumbnails of the images (on the main page, under random files and latest additions) the ALT tag shows up that gives info like the file name, file size etc. I like the ALT tags very much, however - my the info on my ALT tags are all bunched up in ONE whole line. Eg. "File name=XXX.jpg File Size=XXX kb Dimensions=XXX......etc"

I was wondering whether there was a way to edit the way these ALT tags came up. I would like to be able to display that info, from:

File name=XXX.jpg File Size=XXX kb Dimensions=XXX......etc

to something like this:

File name=XXXjpg
File Size=XXX kb
Dimensions=XXX x XXX

---------------------------------
In other words, I'd like to put each detail on a separate line.

Where and How may I be able to do this?


Any Help would be greatly appreciated :) Thanks!

Stramm

read this article
http://www.netmechanic.com/news/vol6/design_no18.htm

the code is in include/functions.inc.php
function display_thumbnails()




2002

Hi,

Thanks for replying. I noticed that the ALT tags were fine (the info on a separate line) in IE even without any editing of the code. But when I used Mozilla Firefox, the information in the ALT tags was all stuffed onto one line.

I'm not really experienced with PHP, so I'm not sure what I have to do in that functions.inc file. Am I meant to insert a break ( <br> ) between some of those tags to get it to work with Firefox?

This is where I'm looking in the functions.inc.php file:


function display_thumbnails($album, $cat, $page, $thumbcols, $thumbrows, $display_tabs)
{
        global $CONFIG, $AUTHORIZED;
        global $album_date_fmt, $lang_display_thumbnails, $lang_errors, $lang_byte_units;

        $thumb_per_page = $thumbcols * $thumbrows;
        $lower_limit = ($page-1) * $thumb_per_page;

        $pic_data = get_pic_data($album, $thumb_count, $album_name, $lower_limit, $thumb_per_page);

        $total_pages = ceil($thumb_count / $thumb_per_page);

        $i = 0;
        if (count($pic_data) > 0) {
                foreach ($pic_data as $key => $row) {
                        $i++;

                        $pic_title =$lang_display_thumbnails['filename'].$row['filename']."\n".
                                $lang_display_thumbnails['filesize'].($row['filesize'] >> 10).$lang_byte_units[1]."\n".
                                $lang_display_thumbnails['dimensions'].$row['pwidth']."x".$row['pheight']."\n".
                                $lang_display_thumbnails['date_added'].localised_date($row['ctime'], $album_date_fmt);

                        $pic_url =  get_pic_url($row, 'thumb');
                        if (!is_image($row['filename'])) {
                                $image_info = getimagesize(urldecode($pic_url));
                                $row['pwidth'] = $image_info[0];
                                $row['pheight'] = $image_info[1];
                        }

                        $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);

                        $thumb_list[$i]['pos'] = $key < 0 ? $key : $i - 1 + $lower_limit;
                        $thumb_list[$i]['pid'] = $row['pid'];;
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
                        $thumb_list[$i]['caption'] = bb_decode($row['caption_text']);
                        $thumb_list[$i]['admin_menu'] = '';
                        $thumb_list[$i]['aid'] = $row['aid'];
                }
                theme_display_thumbnails($thumb_list, $thumb_count, $album_name, $album, $cat, $page, $total_pages, is_numeric($album), $display_tabs);
        } else {
                theme_no_img_to_display($album_name);
        }
}


Where and how do I start editing it? Do I use <br> in here?

Thanks  :)

Joachim Müller

As suggested, you can't use <br> within the alt or title tag. It's simply not within the specification of those tags. The HTML tag <br> (you better use <br /> by the way) does not equal a line break in the source.

2002

Oh, thanks for that  :o

What do I use to insert a break then?

Joachim Müller

Did you actually read the article that Stramm has refered to?