coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: grantson on October 14, 2010, 04:31:47 PM

Title: the alt tag
Post by: grantson on October 14, 2010, 04:31:47 PM

Been pulling my hair out for a few days wondering why google tells me the most prevalent keyword on my page is .jpg
(it shouldnt be crawling thumbnails.php but never mind)

I had a quick search on how to change the alt tag from the filename under 1.5x and could only find the following abandoned post
http://forum.coppermine-gallery.net/index.php/topic,66104.msg328686.html#msg328686
(http://forum.coppermine-gallery.net/index.php/topic,66104.msg328686.html#msg328686)

whether its to the album name, website url or even just the filename without the extenion any help on this one would be apreciated

Grant
www.magicmirrorphoto.co.uk/gallery (http://www.magicmirrorphoto.co.uk/gallery)
Title: Re: the alt tag
Post by: Αndré on October 14, 2010, 05:02:54 PM
What exactly do you want to achieve?
Title: Re: the alt tag
Post by: grantson on October 14, 2010, 05:59:44 PM
as i say at the moment the alt text for each picture in my gallery is #####.jpg
which is screwing up the keywords when the site is crawled by the search engines

im just looking to edit the alt text for each picture whether there is a method to trim off .jpg or change it entirely
without having to edit several hundred manually

Title: Re: the alt tag
Post by: Αndré on October 14, 2010, 06:23:10 PM
Quote from: grantson on October 14, 2010, 05:59:44 PM
im just looking to edit the alt text for each picture whether there is a method to trim off .jpg or change it entirely
It's an easy task to trim the file extension. If that's the solution you want I'll come up with a code snippet. If you want to change it entirely, please specify what exactly should be used.
Title: Re: the alt tag
Post by: grantson on October 14, 2010, 06:45:20 PM
go for trimming the file extension
i  can always use it for guidance later :)   
Title: Re: the alt tag
Post by: Αndré on October 15, 2010, 11:01:22 AM
Open include/functions.inc.php, find
            $thumb_list[$i]['image']        = '<img src="' . $pic_url . '" class="image" ' . $image_size['geom'] . ' border="0" alt="' . $row['filename'] . '" title="' . $pic_title . '" />';
and replace with
            $row['fileinfo'] = pathinfo($row['filename']);
            $thumb_list[$i]['image']        = '<img src="' . $pic_url . '" class="image" ' . $image_size['geom'] . ' border="0" alt="' . basename($row['filename'], '.'.$row['fileinfo']['extension']) . '" title="' . $pic_title . '" />';
Title: Re: the alt tag
Post by: grantson on October 15, 2010, 05:32:00 PM
Andre as always top notch :)

thats another beer I owe you lol