Author Topic: How to edit ALT tags for thumbnails?  (Read 16338 times)

0 Members and 1 Guest are viewing this topic.

Offline Threnody

  • Newbie
  • *
  • Posts: 10
    • View Profile
How to edit ALT tags for thumbnails?
« on: February 17, 2006, 04:05:41 PM »
Good morning everyone!

I was wondering where one might edit the ALT tags for the thumbnail images that are automatically generated.  I was able to edit the tags for the previous and next thumbnail images displayed on the Details page.  However, I have not been able to figure out how to edit the tags for the thumbnails displayed in the Random Image and Thumbnail Bit pages, which call the images with the following bit of code:  {thumbnail}.

I have searched through the forums and google for the answer to but to no avail, and any help would be appreciated.  Thanks in advance!

namaste,
Jennifer

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: How to edit ALT tags for thumbnails?
« Reply #1 on: February 17, 2006, 04:21:50 PM »
that you have to do in the includes/functions.php

Code: [Select]
$thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
When you search for this line, there is the alt tag.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline Threnody

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #2 on: February 17, 2006, 05:39:25 PM »
Thank you so much for the quick response!

I edited the ALT tag, saved the file and uploaded it to my server.  When I reloaded the index page for the gallery in my browser the ALT tag doesn't display quite properly.   :oops:

Here's what I have entered:

Code: [Select]
$thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name." submitted by ".$user_name." on ".$image_date."\." />";
Here is what the ALT tag displays:

Quote
Bardic Champion submitted by  on  .

And Here is what I want the ALT tag to display

Quote
Bardic Competition submitted by Sung Sai-êrh on 16.02.2006 18:53.

Any suggestions or advice on what I might be doing wrong?

namaste,
Jennifer

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #3 on: February 17, 2006, 05:57:17 PM »
May I ask where the $image_date comes from ? Perhaps you coded it by yourself and made a mistake. To make sure, would it be possible to post that string definition here (as well as the $user_name) ? ;)

Offline Threnody

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #4 on: February 17, 2006, 07:00:53 PM »
TheOracle,

No custom scripting.  :)

I simply used the $image_date and $user_name from the details page under my templates and modified it for the includes/functions.php.

Here's the code from that page:

Code: [Select]
<img src="{next_thumb_file}" border="1" vspace="6" hspace="10" alt="{image_name} submitted by {user_name} on {image_date}." title="{image_name} submitted by {user_name} on {image_date}." />
namaste,
Jennifer

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #5 on: February 17, 2006, 07:06:30 PM »
In that case, other opinions might be posted, but I do not believe the $user_name and the $image_date also applys on that function. However, there's another way to do it. Let me a moment (also if no one else posts an alternative solution before I do). ;)

Offline Threnody

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #6 on: February 17, 2006, 08:24:14 PM »
Thanks, I'll see if I can come up with something as well!  :)

namaste,
Jennifer

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #7 on: February 17, 2006, 08:43:01 PM »
Solution found. ;)

In your includes/functions.php file,

find :

Quote

$file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);


add above :

Code: [Select]

$image_info_submission = $lang['user_name_image_submission']. $image_row['user_name']. REPLACE_EMPTY. $lang['image_date_submission']. $image_row['image_date'];


Then, on the same paragraph,

find :

Quote

$thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";


replace with :

Code: [Select]

$thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_info_submission."\" />";


Then, in your lang/english/main.php file,

add the following above the '?>' tag :

Code: [Select]

//-----------------------------------------------------
//--- Image submission by users & date ----------------
//-----------------------------------------------------
$lang['user_name_image_submission'] = "(submitted by:";
$lang['image_date_submission'] = "on: )";


Then, refresh your site. These should do it. ;)

Then, back in your includes/functions.php file (updated),

find :

Quote

global $site_sess, $config;


replace with :

Code: [Select]

global $site_sess, $config, $image_row, $lang;

« Last Edit: February 17, 2006, 09:02:17 PM by TheOracle »

Offline Threnody

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #8 on: February 17, 2006, 09:16:02 PM »
So the code in fuction.php should look like:
Code: [Select]
    else {
      $image_info_submission = $lang['user_name_image_submission']. $image_row['user_name']. REPLACE_EMPTY.

$lang['image_date_submission']. $image_row['image_date'];
      $file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height."

alt=\"".$image_info_submission."\" />";

And the code in main.php should look like:
Code: [Select]
//-----------------------------------------------------
//--- Admin Links -------------------------------------
//-----------------------------------------------------
$lang['edit'] = "[Edit]";
$lang['delete'] = "[Delete]";

//-----------------------------------------------------
//--- Image submission by users & date ----------------
//-----------------------------------------------------
$lang['user_name_image_submission'] = "(submitted by:";
$lang['image_date_submission'] = "on: )";
?>

Right?

namaste,
Jennifer

RE: UPDATED: Yi yi yi yi yi!  That did it! Thank you so much!!!

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #9 on: February 17, 2006, 10:10:48 PM »
Quote

RE: UPDATED: Yi yi yi yi yi!  That did it! Thank you so much!!!


You're also right, it looks really good like this. Thanks for posting this request. ;)

Offline Threnody

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #10 on: February 18, 2006, 03:41:11 PM »
You're welcome!  But I have to give credit where credit's due - I got the idea from deviantART.   :wink:

Did the image date look a little funky in the ALT tag when you tried this out?  I'm finding that mine does.  :)

Thanks again!


namaste,
Jennifer

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #11 on: February 18, 2006, 03:45:43 PM »
Quote

Did the image date look a little funky in the ALT tag when you tried this out?  I'm finding that mine does.


Well, it depends of your definition of funky but, now that you mention it, I did left a tighny too much of space between the text and the date. :mrgreen:

Offline Threnody

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to edit ALT tags for thumbnails?
« Reply #12 on: February 18, 2006, 03:54:31 PM »
Well, it depends of your definition of funky but, now that you mention it, I did left a tighny too much of space between the text and the date. :mrgreen:

Well, when I pull up my site in IE the date in the ALT tag looks pretty much like a jumbled bunch of numbers instead of the date.

Quote
Valor Champion submitted by Sung Sai-êrh on 1140140764.

See?  *laughs*

namaste,
Jennifer

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: How to edit ALT tags for thumbnails?
« Reply #13 on: February 18, 2006, 05:54:37 PM »
Use instead of
Code: [Select]
$image_info_submission = $lang['user_name_image_submission']. $image_row['user_name']. REPLACE_EMPTY. $lang['image_date_submission']. $image_row['image_date'];this
Code: [Select]
$image_info_submission = $lang['user_name_image_submission']. $image_row['user_name']. REPLACE_EMPTY. $lang['image_date_submission']. format_date($config['date_format']." ".$config['time_format'],$image_row['image_date']);
the numbers you can seen are in unix timestamp format.
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: How to edit ALT tags for thumbnails?
« Reply #14 on: February 18, 2006, 08:53:58 PM »
@TheOracle:
REPLACE_EMPTY should not be used in this case, because even though it represent &nbsp;, it can be altered and in this case it might bring unexpected results...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)