PDA

View Full Version : Miscellaneous Hacks - Add ALT and/or TITLE text to linked images in VB3 by BOP5


BirdOPrey5
03-14-2012, 11:00 PM
Brought to you by BirdOPrey5 / Qapla.com (http://www.qapla.com/mods/)

The purpose of this mod is to add alt text and/or title text to to the <img> tags generated in VB3.x when an image is linked in a post.

This is the Standard Version. The GOLD Version is FREE but available only from:
Qapla.com - Add Alt Text GOLD by BOP5 Mod (http://www.qapla.com/mods/showthread.php/265-Add-Alt-Text-to-Images-GOLD-by-BOP5-for-VB3)

The GOLD edition has 1 additional feature: Smart Tagging
Smart Tagging will check the filename of an image for useful information. If the mod believes the filename can be useful to describing the image it will use a cleaned and formatted version of the filename as the alt or title text. If the mod sees that the filename is all numeric, or a common digital camera format, or a vbulletin attachment filename it will instead use the thread title as the alt/title text for the image.

The Standard edition has only 3 options for alt or title text, each of which can be set independently. - Use Filename, Use Thread Title, or use both Filename AND Thread Title to create the tag.

THIS MOD REQUIRES 1 MANUAL FILE EDIT
Instructions included, the class_bbcode.php file must be edited. Detailed instructions are included on the ONE edit that must be made.

Since VB 3.8.7 is the last VB 3.x release a manual file edit isn't very annoying since you'll never have to worry about re-doing it unless you re-install your forum.

If you ever upgrade to VB4 there is a separate VB4 version (https://vborg.vbsupport.ru/showthread.php?t=277033) that doesn't require any file edits.

Live Demo: A random image posted on JUOT Forums (http://www.juot.net/forums/showthread.php?p=1278001#post1278001)

------------------------------------------------------

Please "Mark as Installed" if you use this. :)
Donations always appreciated. :up:
Nominate MOTM if you LOVE it! ;)

BirdOPrey5
03-15-2012, 02:26 PM
Reserved.

BirdOPrey5
03-16-2012, 03:01 PM
I updated the zip file, I had included the wrong instructions for the manual file edit- my apologies.

The real edit, which has been fixed in the instructions now is:

Open file /includes/class_bbcode.php

Find in file: function handle_bbcode_img_match
or
Go to line #: 1993(in VB 3.8.7, may vary in other versions)

Change:
return '<img src="' . $link . '" border="0" alt="" />';

To:
//return '<img src="' . $link . '" border="0" alt="" />';
($hook = vBulletinHook::fetch_hook('bbcode_img_match_vb3')) ? eval($hook) : false;
$retval = '<img src="' . $link . '" border="0" alt="'.$bop5alt.'" '.$bop5title.$bop5rscode.' />';
return $retval;

Abu2
03-19-2012, 05:10 PM
//return '<img src="' . $link . '" border="0" alt="" />';
($hook = vBulletinHook::fetch_hook('bbcode_img_match_vb3')) ? eval($hook) : false;
$retval = '<img src="' . $link . '" border="0" alt="'.$bop5alt.'" '.$bop5title.$bop5rscode.' />';
return $retval;
It works perfect in FireFox, but not in IE9.
Image resizer not working in IE9 at all with this code. (I use ncode)
Why?

BirdOPrey5
03-19-2012, 09:11 PM
It's working on my IE9...

Does it work for you on this page:
http://www.juot.net/forums/showthread.php?p=1286813#post1286813

Please give me a link to a thread on your site with the problem.

htscpl
03-20-2012, 10:01 PM
Just installed on my vb3.8 and it seems to be working just fine. Thanks! :D

weindians
03-21-2012, 09:25 PM
Has this anything to do with [img] tag which normaly used while posting

BirdOPrey5
03-21-2012, 11:07 PM
Yes, this works specifically with the regular [img] tag.

weindians
03-23-2012, 05:30 PM
great BOP5... thanx for the mod.. also is there a option to add alt text to images exits... also "image linked in post" means <img src"link"/> ??? what if images inserted like link or is it hotlinking images??

BirdOPrey5
03-23-2012, 06:28 PM
This will work for all images added via the [IMG] BBCode- It works all existing posts as well, not just new ones.

If it isn't showing on an old post it may mean the post cache needs to be cleared. You can edit-and-resave the post to force the cache to update.

weindians
03-24-2012, 12:44 AM
editing and saving posts will be bit time consuming, to check which images in threads are not showing when u have 73k+ threads.... i'm going to install it... thanx..

Update: i installed the gold version from Qapla... used 'alt text' only with 'thead title ' option... its giving all images including signature images same alt tag...?? also i feel smart tag is bad for tinypic hosted images , just numbers u get in alt text

BirdOPrey5
03-24-2012, 01:46 AM
If you used the "thread title" option then yes, every image in the thread (signature or otherwise) will have the thread title as the alt text... That's what it's supposed to do.

Next version will have an option to disable it on signatures. I actually posted code to do it now if you want in the Qapla.com thread, somewhere on the first page or two.

I'll look at fixing tinypic in the next update as well, thanks for the info.

weindians
03-26-2012, 04:27 PM
no worries BOP5.... for tinypic any image uploaded gets just numbers.jpg ..do they actually store the orig image name which can be pulled using that number? are u going to exclude tinypic from adding alt/title text

BirdOPrey5
03-26-2012, 06:43 PM
I just uploaded this to tnypic and it's not all numbers... can you give me an example link?

https://vborg.vbsupport.ru/external/2012/03/10.jpg

weindians
03-26-2012, 09:34 PM
its not only numbers letters to.. random way,....

http://i42.tinypic.com/5lbbb6.jpg.... uploaded with name 'boink' and extension 'gif'. i have an account with tinypic..... it never gave me original file name..

al2thero
12-02-2012, 01:15 AM
Great. Thank you.

Manoel J?nior
12-02-2012, 12:24 PM
Update for 4.x please

BirdOPrey5
12-02-2012, 09:52 PM
VB4 Version: https://vborg.vbsupport.ru/showthread.php?t=277033

soner
08-14-2013, 03:13 PM
Thanks.!
Installed..

BirdOPrey5
08-17-2013, 11:13 AM
Thanks, but please click the "Marked as Installed" button in the top post.

https://vborg.vbsupport.ru/external/2013/09/18.jpg

freak46
04-16-2014, 03:29 PM
Thanks i am going to install this mod