Advertisement:
GCWebhosting

Author Topic: Built-in Image Resizer in SMF 2.0 RC3  (Read 7212 times)

Offline tycms

  • Semi-Newbie
  • *
  • Posts: 88
Built-in Image Resizer in SMF 2.0 RC3
« on: April 04, 2010, 07:31:58 AM »
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?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,243
    • StoryBB/StoryBB on GitHub
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #1 on: April 04, 2010, 07:32:35 AM »
It only works on newly posted images, it won't resize existing ones.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline tycms

  • Semi-Newbie
  • *
  • Posts: 88
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #2 on: April 04, 2010, 08:10:33 AM »
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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,243
    • StoryBB/StoryBB on GitHub
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #3 on: April 04, 2010, 08:40:25 AM »
Where are these images hosted?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline tycms

  • Semi-Newbie
  • *
  • Posts: 88
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #4 on: April 04, 2010, 08:55:26 AM »
The larger image is hosted on an external website. The other one is an image uploaded to imageshack by me.
« Last Edit: April 05, 2010, 07:49:18 AM by budun »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,243
    • StoryBB/StoryBB on GitHub
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #5 on: April 04, 2010, 09:04:31 AM »
Yeah, ImageShack images don't tend to work but no-one's entirely sure why.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline tycms

  • Semi-Newbie
  • *
  • Posts: 88
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #6 on: April 05, 2010, 08:00:04 AM »
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.

Code: [Select]
[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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,243
    • StoryBB/StoryBB on GitHub
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #7 on: April 05, 2010, 08:01:51 AM »
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)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline tycms

  • Semi-Newbie
  • *
  • Posts: 88
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #8 on: April 05, 2010, 08:28:48 AM »
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.

Code: [Select]
[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.)

Code: [Select]
[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. :)
« Last Edit: April 05, 2010, 08:34:18 AM by budun »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,243
    • StoryBB/StoryBB on GitHub
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #9 on: April 05, 2010, 08:33:50 AM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline tycms

  • Semi-Newbie
  • *
  • Posts: 88
Re: Built-in Image Resizer in SMF 2.0 RC3
« Reply #10 on: April 05, 2010, 08:41:28 AM »
This explains why SMF cannot check the image dimensions and add the parameters for some image hosts. Thanks. Topic was already marked solved.