Built-in Image Resizer in SMF 2.0 RC3

Started by tycms, April 04, 2010, 07:31:58 AM

Previous topic - Next topic

tycms

Hello,

I am using SMF 2.0 RC3. I would like use the built-in image resizer instead of nCode mod.

I see a working sample here:
http://forum.320volt.com/index.php/topic,200.msg718.html#msg718

But I cannot make it work in my own tests.

Admin CP > Configuration > Features and options > Layout

Max width of posted pictures (0 = disable)
Max height of posted pictures (0 = disable)

I change these numbers, but it doesn't work. Do I miss something?

Arantor

It only works on newly posted images, it won't resize existing ones.

tycms

I set the maximum width to 500. I tested it with the 2424x1664 image that I mentioned in my first post. Interesting enough, that one works, but when I try it with a 759x259 image it doesn't work.

Arantor


tycms

#4
The larger image is hosted on an external website. The other one is an image uploaded to imageshack by me.

Arantor

Yeah, ImageShack images don't tend to work but no-one's entirely sure why.

tycms

Thank you Arantor. Yes, you are right. Image resizing doesn't work with images hosted on Imageshack. Tinypic doesn't work either. I tried another image host and it worked for all images.

When I manually try the following bbcode for images hosted anywhere (including imageshack and tinypic), image resizing works.


[img width=xxx height=xxx][/img]


I wish I could use the built-in feature rather than a mod like nCode. It is peculiar that built-in image resizing works for some image hosts and does not work for others. I think this is a bug which should be fixed until the first stable release of SMF 2.0. I hope the developers are aware of this bug.

Arantor

I think it's down to the methods used by ImageShack and TinyPic; and I suspect there's not a lot SMF can actually do, I have a feeling it's an anti abuse measure they use (to prevent bots abusing their bandwidth)

tycms

#8
As far as I understand, this is how the built-in image resizing of SMF works:

Suppose that maximum width is set to 600 by the forum admins.
The user adds an image using the img bbcode.
When the user clicks "Post" button, SMF checks the image size and places the following parameters in between the img tags.


[img width=600 height=hhh]link-to-image[/img]

where hhh is set proportionally.


SMF fails to add these parameters for some image hosts. But when the user adds these parameters manually, it works. That's why I think this is a problem related to SMF.

More to that, let's suppose that the user replaced the image on the image host with another image having a different width-height ratio. The dimensions of the resized image will probably still be 600xhhh and the image will look weird. To avoid this, SMF should only add the width parameter assuming that the forum admins only set the maximum width.
(It would be vice-versa if forum admins only set the maximum height.)


[img width=600]link-to-image[/img]


One more thing I can think of: What if the forum admins change the width of the whole forum and set a new image width limit? The images in the older posts will remain the same. There is no mechanism in this algorithm which could update the older posts.

Maybe the SMF developers should think again about this built-in image resizing.

Thanks Arantor. :)

Arantor

You don't understand how it works.

When you put an image in, when the post is saved, SMF checks to see if you had a limit on it. If there's a limit, your SERVER downloads the picture.

Since your server appears to be a bot, ImageShack and TinyPic reject the connection. SMF doesn't know what went wrong so it does the only sensible thing it can do - just allow it as-is.

It IS NOT an SMF problem and there is NOTHING SMF can do.

tycms

This explains why SMF cannot check the image dimensions and add the parameters for some image hosts. Thanks. Topic was already marked solved.

Advertisement: