Log in

View Full Version : Large pictures in posts breaks non-liquid layout


doob
09-15-2010, 01:42 AM
When users post images from URLS that are bigger than our fixed layout, the pictures break out of the layout. Any creative ways to prevent this?

doob
09-16-2010, 02:21 AM
This page, on the vbulletin.org site, is an example of what I'd like to find a solution for...
https://vborg.vbsupport.ru/showthread.php?t=248534

kh99
09-17-2010, 01:54 PM
There are mods for resizing images, they use attributes in the img tags to set a maximum width and height. I don't know of a specific one offhand but it shouldn't be too hard to find if you search.

doob
09-18-2010, 07:23 AM
So far I'm not much of a fan of mods since they don't generally seem very well supported or documented.

I'll try and figure out what, if any, tags or css are getting applied to images. Maybe the key is there somewhere.

Any ideas on doing fixing this without a mod?

kh99
09-18-2010, 12:12 PM
Check out this mod: https://vborg.vbsupport.ru/showthread.php?t=214600&highlight=image

if you don't want to install the mod, open up the file and look at the code, it's just a 2-line plugin.

...and if you don't even want to do that, what it does is basically

str_replace('<img', '<img style="max-width: ' . $maxwidth . 'px "');

plus some other stuff that looks like it lets you click on the image to see it full size in a popup window.

doob
09-22-2010, 04:36 AM
I tried creating my own plugin and got a php error as soon as I activated it, so I disabled it. After several permutations, I ultimatley tried installing the Image Resizer plugin and also got a php error as soon as it was activated, so too deactivated that...

If you can help with exact syntax that I'd want to use for just creating a plugin that would be hugely helpful.

I'll give this another try in few days when more time frees up, at which point I'll also be able to post the code I'm attempting to use for the plugin as well as any error being generated.