forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: mreider on May 08, 2006, 04:50:51 pm
-
I'm going crazy - How can I change the alt attributes of all the images? Right now they show filesize etc and I can't figure out what file I need to edit to change this to the actual title of the image.
I've done a search through all files for 'alt="' and still haven't found the right one.
I'm using CPG 1.4.5.
If someone could point me in the right direction of which file needs to be edited thatd be great. I looked at other threads and couldn't find an answer either, sorry if I missed one.
-
Copy function theme_html_picture() from themes/sample/theme.php to the theme.php you're using. Within that function look for the img tag and modify it to your needs. That's for the intermediate view...
-
Thanks, I managed to get that working.
What I'm trying to do though is have the alt attribute set as the pictures title.
I've tried this code:
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"{TITLE}\" /><br />\n";
But that just changes the alt to "{TITLE}".
Do you know how to get it to render the actual title? Do I have to pull it somehow in a different variable?
Thanks again
-Matt
-
instead of TITLE
try
$CURRENT_PIC_DATA['title']
-
That did the trick! Now I can play with a few other settings :)
Thanks again Stramm
-
Or actually one quick questoin if you happen to know the answer off hand - Do you know where to modify the title attributes for the thumbnails that appear on the index.php?
-
function theme_display_thumbnails ;)
that's globally for all thumbs (not just the thumbs on index and not for the album thumbs on the index)
-
Thanks Stramm.
I found the function, but can't find the title="whatever" in it.
Is there somewhere that is defined? Or am I just missing it?
-
sorry, it's in include/functions.inc.php - function display_thumbnails
replace
$thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
with
$thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$row['title']}\"/>";
-
Exactly what I was looking for!
Thanks Stramm - I also installed your mod pack, and it's working beautifully. Thanks for all your contributions.
;D
-
i really don't understand it
in function theme_html_picture() there are much text,
i'm using version 4.6,can you help me and add file here plz?...so i can replace it
i want the title and the name of pictures to alt also,
waiting your help
-
thanx Stramm ,i see the picture title in alt now but only for thumbnails
but in display image when i point to pic i still see: click to view full size image
so how can i edit it to add the image title as alt?
-
as said, just look for the img tag in the function theme_html_pictures and modify it to your needs
then that's the relevant part for you in that function
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
-
hi there
i added this title=\"{$row['title']}\"/>";
but it didn't work with me
when i put mouse in image i still see:
click to view full size image
so how can i add the image title as the image alt,so it will appear as:
image alt and click to view full size or only image title alt
can you fix it for me plz?
-
that's made-up code. There's no constant named title. Do as suggested in the previous posting.
-
hello Folks,
I made the adjustment show here by Stramm for the intermediate image, and I managed to get it right. Works great, thank you. However, I would also like to adjust the alt tag on the thumbnails page, and can't seem to get it to work. How do I make the alt tags for the thumbnails be the title I have coded in my IPTC data? I would also like the little yellow box that pops up when I mouse over a thumbnail to be the caption from the IPTC data. Are you saying I should adjust the include/functions.inc.php code? I thought I had read on here numerous times never to make adjustments to that code.
Any help is very much aprpeciated, as always.
Thank you.
Cheers
Carl
-
have you read this
http://forum.coppermine-gallery.net/index.php?topic=31277.msg144833#msg144833
-
Hey Stramm,
Yes, I had read that, but just now re-read it (thanks). I made the changes and it works great, thank you. I thought I had seen people here say never to change that file, so I wasn't sure if that's what I was supposed to do.
Thanks for your patience.
Cheers
Carl
-
you're absolutely right, the right way to do it is to copy that function to the theme.php you're actually using (from themes/sample/theme.php to eg. themes/classic/theme.php) and then do the editing
-
Hey Stramm,
Ahhhh .. uh oh .. I'll, errr, be right back.
Thanks man.
Cheers
Carl
-
Hey Stramm,
I'm sorry man .. I can't find it. When I go to Themes/Sample/theme.php, I find this:
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
global $CONFIG;
global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list;
static $header = '';
static $thumb_cell = '';
static $empty_cell = '';
static $row_separator = '';
static $footer = '';
static $tabs = '';
static $spacer = '';
if ($header == '') {
$thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
$tabs = template_extract_block($template_thumbnail_view, 'tabs');
$header = template_extract_block($template_thumbnail_view, 'header');
$empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
$row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
$footer = template_extract_block($template_thumbnail_view, 'footer');
$spacer = template_extract_block($template_thumbnail_view, 'spacer');
}
$cat_link = is_numeric($aid) ? '' : '&cat=' . $cat;
$theme_thumb_tab_tmpl = $template_tab_display;
if ($mode == 'thumb') {
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));
} else {
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
}
$thumbcols = $CONFIG['thumbcols'];
$cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';
$tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
// The sort order options are not available for meta albums
if ($sort_options) {
$param = array('{ALBUM_NAME}' => $album_name,
'{AID}' => $aid,
'{PAGE}' => $page,
'{NAME}' => $lang_thumb_view['name'],
'{TITLE}' => $lang_thumb_view['title'],
'{DATE}' => $lang_thumb_view['date'],
'{SORT_TA}' => $lang_thumb_view['sort_ta'],
'{SORT_TD}' => $lang_thumb_view['sort_td'],
'{SORT_NA}' => $lang_thumb_view['sort_na'],
'{SORT_ND}' => $lang_thumb_view['sort_nd'],
'{SORT_DA}' => $lang_thumb_view['sort_da'],
'{SORT_DD}' => $lang_thumb_view['sort_dd'],
'{POSITION}' => $lang_thumb_view['position'],
'{SORT_PA}' => $lang_thumb_view['sort_pa'],
'{SORT_PD}' => $lang_thumb_view['sort_pd'],
);
$title = template_eval($template_thumb_view_title_row, $param);
} else if ($aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
$param = array('{ALBUM_NAME}' => $album_name,
'{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']
);
$title = template_eval($template_fav_thumb_view_title_row, $param);
}else{
$title = $album_name;
}
if ($mode == 'thumb') {
starttable('100%', $title, $thumbcols);
} else {
starttable('100%');
}
echo $header;
$i = 0;
foreach($thumb_list as $thumb) {
$i++;
if ($mode == 'thumb') {
if ($aid == 'lastalb') {
$params = array('{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
'{THUMB}' => $thumb['image'],
'{CAPTION}' => $thumb['caption'],
'{ADMIN_MENU}' => $thumb['admin_menu']
);
} else {
$params = array('{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}",
'{THUMB}' => $thumb['image'],
'{CAPTION}' => $thumb['caption'],
'{ADMIN_MENU}' => $thumb['admin_menu']
);
}
} else {
$params = array('{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
'{THUMB}' => $thumb['image'],
'{CAPTION}' => $thumb['caption'],
'{ADMIN_MENU}' => ''
);
}
echo template_eval($thumb_cell, $params);
if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
echo $row_separator;
}
}
for (;($i % $thumbcols); $i++) {
echo $empty_cell;
}
echo $footer;
if ($display_tabs) {
$params = array('{THUMB_COLS}' => $thumbcols,
'{TABS}' => $tabs_html
);
echo template_eval($tabs, $params);
}
endtable();
echo $spacer;
}
I don't see the code you copied and changed in here. (http://forum.coppermine-gallery.net/index.php?topic=31277.msg144833#msg144833) When changed the includes/function.inc.php file, it worke fine . but I can't seem to get it to work using the sample/theme.php. Any idea on what I'm doing wrong?
Thank you.
Cheers
Carl
-
sorry, that's when I'm not taking care enough and assume things but do not verify
unfortunately the function generating the alt for thumbs hasn't been moved over to sample/theme.php... it's still a core function and you'll have to modify functions.inc.php with all its downsides (with every update you need to edit this function, so better write comments)
-
Hey Stramm
Thanks .. I went ahead and did that. I'll keep a little notepad of stuff like this for updates.
Thanks again. I really aprpeciate the help.
Cheers
Carl
-
instead of TITLE
try
$CURRENT_PIC_DATA['title']
hi man, don't works ???
-
hi man, don't works ???
Meaning what? If you expect anwers (especially when trying to hijack threads), post more details: what exactly goes wrong. Usually, posting a link to your gallery and the code snippet you changed is helpfull as well.
-
it's in include/functions.inc.php - function display_thumbnails
$thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$row['title']}\"/>";
i also try this code and its work fine on my site, but its only shows the image title and i need the image name too, like this...
image001.jpg
image of my dog in house (title)
thanks for help.
my site like is http://www.picturerating.us/picture-gallery/index.php