return '<img src="' . $link . '" onload="if(largerThan(this.width,700)) {this.width=700;this.alt=\'Click here to see a large version\';}" onmouseover="if(this.alt) this.style.cursor=\'pointer\';" onclick="if(this.alt) window.open(\'' . $link . '\');" border="0" />';
Step2. Modify the common template of your template set
Add this to the headinclude section:
Code:
<script type="text/javascript">
function largerThan(a,b)
{
return a>b;
}
</script>
Hi Marris,
I tried your code, but it doesn't work for me:
- In IE the image is resized and opens in a pop-up, but the alt tag doesn't show when hoovering over the image with my mouse, although I see it in the source of the page (this.alt='text')
- In FF the images are not affected at all. They don't resize (FF 1.5). In the source of the page I see the script, but it's doing nothing I'm afraid.
But neither of those worked consistently for me. I tried many different combinations and the code block above is what works best for me across IE, Firefox and Opera.
I welcome improvements.
I am having an issue with this. When I go to edit my signature a second time, it displayed the html for that in the signature. It just shows the huge code instead of the image I put it. It doesn't do it the first time around, but it does it if I edit it.
This mod worked fine for me, except when you view the same page after you've been automatically forwarded after posting, and then only some images wouldn't resize. However, for a while now I've personally had a problem with posting URL links, in that I'd post a normal link, but the link would open in the form of; http://"http://www..." and of course wouldn't work. So, it appears that my trouble was in the bbcode file we need to edit. I don't suppose anyone else got this problem, did they? o_O
I'd actually like to reinstall this script, as it's one of the best I've seen, but I'd rather be able to post working links, hehe.
This works perfect with 3.5.3! Thanks Marris! How about images that are attachments? It'd be great if they can be automatically resized too.
Edit: For attached images, I found a simple, built-in solution. Just rebuild your thumnails with your desired size, and 1 image per row (in vbulletin options message attachment).
I have modified the original HTML a bit, since I didn't like it. I use the title attribute instead of the alt attribute, since HTML standards state that the alt attribute is to be used by screen reading software, whereas the title attribute is usually used to display a 'tooltip' when the mouse is positioned above the element in question.
Also, the hand pointer one sees when the mouse is moved over a link is actually a cursor called pointer, not hand, in the standards.
I modified the handle_bbcode_img_match function in the file includes/class_bbcode.php.
Works in all browsers I've tested it in. If it works in Firefox but not IE, I would say the best bet is to check the IE settings. JavaScript may be fully or partially disabled.
Does not work in IE at all and when i click on the image to enlarge it, it doesnt do anything.