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] 2   Go Down

Author Topic: Changing the alt attributes  (Read 12529 times)

0 Members and 1 Guest are viewing this topic.

mreider

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Changing the alt attributes
« 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.
« Last Edit: May 08, 2006, 06:27:04 pm by GauGau »
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Changing the alt attributes
« Reply #1 on: May 08, 2006, 05:36:49 pm »

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...

mreider

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Changing the alt attributes
« Reply #2 on: May 08, 2006, 05:55:23 pm »

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:

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

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Changing the alt attributes
« Reply #3 on: May 08, 2006, 06:01:28 pm »

instead of TITLE
try
$CURRENT_PIC_DATA['title']

mreider

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Changing the alt attributes
« Reply #4 on: May 08, 2006, 06:05:45 pm »

That did the trick! Now I can play with a few other settings :)

Thanks again Stramm
Logged

mreider

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Changing the alt attributes
« Reply #5 on: May 08, 2006, 06:06:38 pm »

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

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Changing the alt attributes
« Reply #6 on: May 08, 2006, 06:12:07 pm »

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)

mreider

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Changing the alt attributes
« Reply #7 on: May 08, 2006, 06:38:39 pm »

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?

Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Changing the alt attributes
« Reply #8 on: May 08, 2006, 07:13:47 pm »

sorry, it's in include/functions.inc.php - function display_thumbnails

replace
Code: [Select]
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"$pic_title\"/>";
with
Code: [Select]
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$row['filename']}\" title=\"{$row['title']}\"/>";

mreider

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Changing the alt attributes
« Reply #9 on: May 08, 2006, 07:20:28 pm »

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
Logged

Seleno

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re:title,and pic name in alt
« Reply #10 on: March 26, 2007, 04:19:47 am »

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
Logged

Seleno

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Changing the alt attributes
« Reply #11 on: March 26, 2007, 05:05:40 am »

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

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Changing the alt attributes
« Reply #12 on: March 26, 2007, 08:15:18 am »

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
Code: [Select]
            $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;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";

Seleno

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Changing the alt attributes
« Reply #13 on: March 27, 2007, 10:29:52 am »

hi there
i added this
Code: [Select]
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?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Changing the alt attributes
« Reply #14 on: March 27, 2007, 10:47:20 am »

that's made-up code. There's no constant named title. Do as suggested in the previous posting.
Logged

Walkinman

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 380
    • Skolai Images - Nature, Travel and Adventure stock photos
Re: Changing the alt attributes
« Reply #15 on: April 12, 2007, 05:37:19 pm »

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
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt

Walkinman

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 380
    • Skolai Images - Nature, Travel and Adventure stock photos
Re: Changing the alt attributes
« Reply #17 on: April 12, 2007, 06:21:51 pm »

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
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Changing the alt attributes
« Reply #18 on: April 12, 2007, 07:37:12 pm »

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

Walkinman

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 380
    • Skolai Images - Nature, Travel and Adventure stock photos
Re: Changing the alt attributes
« Reply #19 on: April 12, 2007, 08:23:35 pm »

Hey Stramm,

Ahhhh .. uh oh .. I'll, errr, be right back.

Thanks man.

Cheers

Carl
Logged
Pages: [1] 2   Go Up
 

Page created in 0.023 seconds with 20 queries.