Image resizing for non-uploads

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Image resizing for non-uploads
« on March 8th, 2012, 03:56 PM »
Right now we have the ability to limit the image size of images posted via the img tag, to ensure they're not made huge.

E.g. if you try and post a massive photo but the settings say 150x150, you get a 150x150 size shown (though it doesn't actually resize/thumbnail the image, it just shows it at that size)

What I'm wondering is whether it might not be a bad idea to indicate that the picture isn't full size in those cases and have it automatically link back to the full size image - or even make use of Zoomedia to do that?
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Image resizing for non-uploads
« Reply #1, on March 8th, 2012, 04:02 PM »
We sure could... Actually I thought it already had this "click img" system...? Wasn't it in theme.js or somewhere?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Image resizing for non-uploads
« Reply #2, on March 8th, 2012, 04:06 PM »
I just tried it and nothing happened that I could see, anyway... but I did it quickly, didn't check for errors, so it's entirely possible there is something already.

Nao

  • Dadman with a boy
  • Posts: 16,082

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Image resizing for non-uploads
« Reply #4, on March 8th, 2012, 04:22 PM »
I would also note there are several SMF mods centered around doing the exact same thing with Highslide etc. so it would be good for us to do something similar in the core using the facilities you already made ;)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Image resizing for non-uploads
« Reply #5, on March 8th, 2012, 05:10 PM »
Yeah. The problem with highslide is the license agreement.
Zoomedia emulates its feature set pretty well but it still needs some work.

spoogs

  • Posts: 417
Re: Image resizing for non-uploads
« Reply #6, on March 8th, 2012, 05:25 PM »
I like the idea here as well... usually when images get resized they seem all blurry to me so anything that can expand to full-size is a plus to me
Stick a fork in it SMF

Aaron

  • Posts: 356
Re: Image resizing for non-uploads
« Reply #7, on March 8th, 2012, 11:46 PM »
Quote from Nao on March 8th, 2012, 04:02 PM
We sure could... Actually I thought it already had this "click img" system...? Wasn't it in theme.js or somewhere?
I know I sneaked that into the 2.0 RC3 release a long time ago. Assuming you kept it whilst rewriting the lot to use jQuery, of course.

Replacing it with Zoomedia sounds like a good idea to me.
"The entire British Empire was built on cups of tea … and if you think I'm going to war without one, mate, you're mistaken."

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Image resizing for non-uploads
« Reply #8, on March 9th, 2012, 06:51 PM »
This is definitely the code in theme.js, as modified for jQuery in Wedge:

Code: [Select]
// Toggles the element height and width styles of an image.
$('img.resized').css('cursor', 'pointer').click(function () {
this.style.width = this.style.height = (this.style.width == 'auto' ? null : 'auto');
});

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Image resizing for non-uploads
« Reply #9, on March 10th, 2012, 01:18 PM »
Hmm, in my test I noticed the .resized was added but clicking on the image did nothing, nor was it with a different cursor.

Would be nice to have Zoomedia on it though, for that extra bit of polish.

Nao

  • Dadman with a boy
  • Posts: 16,082

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Image resizing for non-uploads
« Reply #11, on March 13th, 2012, 11:51 AM »
Instead of worrying about whether it's broken or not, heh, I'm not exactly familiar with Zoomedia. What would I have to do to apply it to something?

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Image resizing for non-uploads
« Reply #12, on March 14th, 2012, 10:51 AM »
I'm afraid I don't remember... :lol:

It's all in AeMe. I'm sure we can cook up a version that works outside of it. (Well, technically it does, for picture embeds. I just don't remember where I'm doing the add_js stuff, ahah...)

No, seriously, Zoomedia was a nightmare to develop. It was done faster than many of the 'nightmares' I worked on, but it was enough of a hassle to encourage me to just leave it be instead of working on adding support for slideshows and video embedding.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Image resizing for non-uploads
« Reply #13, on March 14th, 2012, 01:17 PM »
Well, if it were expected to be used generally, it might be a candidate for inclusion into script.js, then it's just a matter of calling it?

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Image resizing for non-uploads
« Reply #14, on March 14th, 2012, 03:21 PM »
Used generally = on every page...
If we use it only for resized attachments, then it's not every page. How many topics does Wedge.org have with a selection of screenshots and other items that would require resizing...? Not many.
Considering zoomedia.js is half the size of sbox.js, that would mean adding at least one kilobyte to the script file, for a feature that's not used everywhere, unlike our select boxes...
So, I would recommend against it.
An extra hit for every page that has a resized image is perfectly acceptable, especially considering caching, and the fact that the image itself already represents an extra hit... ;)