View Full Version : Hack to limit max width and height for img tag?
Gutspiller
01-23-2002, 05:28 PM
A user found an exploit and created an image width and height a huge a$$ number and it really messed things up. Where can I find a hack that will limit the max image width and height for the image tag? I thought there was one, but I can't seem to find it.
Can somebody please help me, I don't want people to do this again.
Any help would be greatly appreciated.
Thanks.
newvbuser
01-23-2002, 05:50 PM
Hmm interesting was thisusing the tag or upload file tag or some other vbfeature set?
Gutspiller
01-23-2002, 06:35 PM
it was using html image coding and they set the height and width to something that was at least 10 characters long. It had to be at least 100 pages down and 100 pages to the right. Very annoying.
newvbuser
01-23-2002, 06:42 PM
Just turn off html code insert capability while there is a fix?
Gutspiller
01-23-2002, 07:58 PM
turn off html? You funny.
I'm working on a solution to this, which will be posted when it's done. Here's how it works:
A Javascript function (very simple, small one) gets the available width of the browser window (taking into account page resolution, screen size, etc. automatically).
It then subtracts the number of pixels you need for other page sections (like a navigation bar on the side ~200pixels, table padding ~15 pixels, whatever).
It then has actual maximum width in pixels an image can be without "breaking" the page and forcing the veiwer to scroll forever to the right...
Finally it simply overrides whatever image width and height properties it finds and resizes all the images on the page.
I'm not exactly sure if this will all work, but I've got the javascript working, but not yet sure how to integrate it into the pages themselves... any ideas?
Gutspiller
01-23-2002, 09:52 PM
Originally posted by dlst
I'm working on a solution to this, which will be posted when it's done. Here's how it works:
A Javascript function (very simple, small one) gets the available width of the browser window (taking into account page resolution, screen size, etc. automatically).
It then subtracts the number of pixels you need for other page sections (like a navigation bar on the side ~200pixels, table padding ~15 pixels, whatever).
It then has actual maximum width in pixels an image can be without "breaking" the page and forcing the veiwer to scroll forever to the right...
Finally it simply overrides whatever image width and height properties it finds and resizes all the images on the page.
I'm not exactly sure if this will all work, but I've got the javascript working, but not yet sure how to integrate it into the pages themselves... any ideas?
If I understand what you are saying it sounds like a great idea. Sounds like a hack I have installed that I have asked the hacker to make better, but they wont. :( I have one suggestion, on the images that the hack/script is resizing, please please PLEASE make it so that the images are a hyperlink to the full version. This way people that want to see the full version of whatever image was posted (background and whatnot) can click the image and they can see the full version.
Let me know when you release this hack with a PM please. :up:
Um, you're not talking about an HTML resize, then. You're talking about a full thumbnail generator built into the board. That's a much bigger project, and requires something like ImageMagik to funciton. I don't think what I'm doing will help you, considering you want two versions of each image, one small and one large. Sorry.
Gutspiller
01-24-2002, 03:28 PM
UH! Nobody understands OK, you have an image, and although it's size is 1024x768 it shows a version that is something like 500x350 or whatever is porportional to 1024x768, BUT IT ISN'T A THUMBNAIL, it's the same exact picture, just with a set width and hieght. THATS ALL I WANT. Nobody can even make it, it's like they have a brain fart or something... and it's really pissing me off. I don't want it to make a thumbnail, I just want it so whenever somebody posts a picture on my forum it makes sure it doesn't go above the size of 500 x 500, but keeps the image proportional.
Is that so hard to do???
Sorry, I am just getting tired of asking for this hack and everybody seems to just pass it by. :(
Dude, relax.
That's exactly what I was suggesting above to do with Javascript. Go back and reread the post YOU QUOTED above.
And relax.
Gutspiller
01-24-2002, 04:19 PM
Originally posted by dlst
Dude, relax.
That's exactly what I was suggesting above to do with Javascript. Go back and reread the post YOU QUOTED above.
And relax.
https://vborg.vbsupport.ru/external/2003/03/7.gif
Ask and ye shall recieve:
https://vborg.vbsupport.ru/showthread.php?s=&postid=216405#post216405
Don't forget to include plenty of feedback... and let me know what works and what doesn't.
toodles!
-dlst
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.