Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 11-09-2005, 01:28 PM
ILTK ILTK is offline
 
Join Date: Jul 2005
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Supply ALT text for IMG tag

Having ALT text for images in a thread created with the IMG tag would be great for SEO and also to comply with ADA (Americans with Disabilities Act)

One way this could be done and not require any extra knowledge from users, would be to have a setup part where you specify what to parse out of the image filename ('-' '.jpg' '.gif' '.png' etc..), and then stick what's left after those things are parsed out of the filename into the ALT tag.

Just an idea, I don't know how to code this myself, but I think such a plugin would be welcomed by a lot of sites.
Reply With Quote
  #2  
Old 11-09-2005, 05:36 PM
KW802's Avatar
KW802 KW802 is offline
 
Join Date: Jul 2003
Location: A galaxy far, far away...
Posts: 1,450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ILTK,

Hopefully somebody can convert this to a plugin but if you want a 'hack' method.....

In you /forums/includes/class_bbcode.php file look around line 1827 for:
PHP Code:
return '<img src="' $link '" border="0" alt="" />'
... and replace it with:
PHP Code:
$link_file $link;
$link_bits split('/',$link_file);
if(
is_array($link_bits)) $link_file $link_bits[count($link_bits)-1];
$link_bits split('\.',$link_file);
$link_desc str_replace('_'' '$link_bits[0]);
return 
'<img src="' $link '" border="0" alt="' $link_desc '" />'
What that will do is take something like...
PHP Code:
[img]http://www.coolscifi.com/forums/images/cinvin_steelrubber/misc/coolscifi_logo.jpg[/img] 
... and give it an ALT tag of "coolscifi logo" (the "_" is being replaced converted to a space).
Reply With Quote
  #3  
Old 11-12-2005, 12:11 PM
Kila_Bite Kila_Bite is offline
 
Join Date: Apr 2005
Location: UK
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good idea and thanks for the code KW802, however i'm still unclear where the alt tag would sit and what format to put it in. Where do you put the tag? Like you do in normal html after the url but before the /img? And if so, do you use the same syntax as HTML, so alt="text".

Thanks.
Reply With Quote
  #4  
Old 11-12-2005, 02:32 PM
ILTK ILTK is offline
 
Join Date: Jul 2005
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot KW802, that is perfect

@Killa_bite, just name the image using underscores for spaces and this code will take care of the rest, you don't have to specify the alt text.

For example:

keyword1_keyword2.jpg

Would make it insert alt="keyword1 keyword2" for you.
Reply With Quote
  #5  
Old 11-12-2005, 03:43 PM
KW802's Avatar
KW802 KW802 is offline
 
Join Date: Jul 2003
Location: A galaxy far, far away...
Posts: 1,450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ILTK
Thanks a lot KW802, that is perfect
No problem.
Reply With Quote
  #6  
Old 05-26-2006, 04:31 PM
kofoid kofoid is offline
 
Join Date: Dec 2005
Location: Colorado
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way to do this for your logo graphic?
Reply With Quote
  #7  
Old 05-26-2006, 04:46 PM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, for your logo graphic you'd just manually put in alt="", wouldn't you? It's not dynamic, unless you've made it that way.
Reply With Quote
  #8  
Old 12-02-2008, 01:24 PM
greatwallforum's Avatar
greatwallforum greatwallforum is offline
 
Join Date: Jul 2008
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many images have names with no SEO or ADA value, such as IMG_1234.jpg.

How can I use the thread title or the forum name instead of the image filename?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:04 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04216 seconds
  • Memory Usage 2,235KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete