Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Topic started by: Seph|roth on September 14, 2003, 11:42:58 AM

Title: resize too large images
Post by: Seph|roth on September 14, 2003, 11:42:58 AM
for the sake of readability...

i would like to see that images that are too large are automatically resized to fit. When a user clicks on the pic, the full-sized one is opened in a new window.

Like on this forum: http://forum.fok.nl
An example: http://forum.fok.nl/showtopic.php/385635
Title: Re:resize too large images
Post by: Bouminok on September 14, 2003, 11:52:24 AM
Seems a good idea... for a few minutes I thought you meant avatar images, since my knowledge of dutch is non-existant.

I like it, save a massive scroll horizontally to see a full image.
Title: Re:resize too large images
Post by: Shoeb Omar on September 14, 2003, 11:57:32 AM
Umm... not sure if you can do this with PHP, but you would need to find out whether the image is under the size proportions and if it is, don't resize it, but if it isn't resize it.  Get my drift?

Anyway, I think you'd probably need somethign like Imagemagick installed for this, but as I sad I don't know :).
Title: Re:resize too large images
Post by: Seph|roth on September 14, 2003, 12:08:26 PM
imagemagick... or GD, which is pretty common nowadays... most hosts have it installed.
Title: Re:resize too large images
Post by: Shoeb Omar on September 14, 2003, 12:09:07 PM
GD can be used for image manipulation?  I always though ti was for image creation heh.
Title: Re:resize too large images
Post by: Owdy on September 14, 2003, 12:09:41 PM
Nice images Seph|roth  :P  ;D
Title: Re:resize too large images
Post by: Seph|roth on September 14, 2003, 12:30:38 PM
GD can be used for image manipulation?  I always though ti was for image creation heh.
can be used for both

Nice images Seph|roth  :P  ;D
thought you might like 'em ;)
Title: Re:resize too large images
Post by: Seph|roth on September 14, 2003, 03:46:32 PM
I don't even think they use GD or something similar for this... i think they have a PHP script that checkes the posted img's width+height, let's say 300x600.. max allowed width is let's say 200 => the script calculates the appropriate height (in this case that will be 300 400 ;)) => and the script writes those values to the <img> tag. causing the browser to auto resize the img. Tha't why the img's will look a bit cluttered afterwards.. but you don't need any lib's for it this way.

Anyway, just a guess how i could be done maybe :P
Title: Re:resize too large images
Post by: Shoeb Omar on September 14, 2003, 05:30:19 PM
Yes, but if the image size is smaller than the limit it will stretch it.. unles syou use javascirpt, or php to detect if it;s under the size
Title: Re:resize too large images
Post by: Seph|roth on September 14, 2003, 05:54:34 PM
Yes, but if the image size is smaller than the limit it will stretch it.. unles syou use javascirpt, or php to detect if it;s under the size
well, if it can detect the size (which it can ;)), you can ofcourse make it so that when it is smaller than max-width, it doesn't do anything...

Anyhow, i think this is how they do it a the forum i listed above...
Title: Re:resize too large images
Post by: Brian Lacy on September 15, 2003, 10:30:50 AM
Good idea. I run a forum for the development of an adventure game, and whenever people post background or concept images, it throws the whole forum out of whack for people with smaller screen resolutions (i.e. 800x600). I'd very much like to have larger images automatically resized to a maximum value -- perhaps a value that could be specified by the admin?

There's one problem though -- how to manipulate images that are located on other servers, and linked to with the [ img ] tag? Auto-displayed attachments are less of an issue since they're still on the server -- although, it would be a performance saver to generate a reduced-size image at post time instead of resizing the image every time its displayed. So maybe there ought to be a new directory for this -- something akin to /attachments/resized perhaps -- where any attachments or linked images can be resized and stored?

One way is a performance hit, the other way takes up lots of disk space. I say someone should make this a mod and leave it up to the Admin to use whichever method they prefer.
Title: Re:resize too large images
Post by: [Unknown] on September 15, 2003, 11:19:55 AM
I thought this feature was already in even YaBB SE...?

Max width/height... makes your forum intolerably slow... ring any bells?

-[Unknown]
Title: Re:resize too large images
Post by: Parham on September 15, 2003, 12:34:30 PM
GD can be used for image manipulation?  I always though ti was for image creation heh.

create a new image of an existing one... GD is great ^^
Title: Re:resize too large images
Post by: Bouminok on September 15, 2003, 12:41:47 PM
I thought this feature was already in even YaBB SE...?

Max width/height... makes your forum intolerably slow... ring any bells?

-[Unknown]

I suppose, but it doesn't make it open in a new window when its been clicked on does it?
Title: Re:resize too large images
Post by: Omar Bazavilvazo on September 15, 2003, 01:31:50 PM
the mod created by anguz is fine enough... :P

uses CSS to only display an area.. but.. is better as a mod...
Title: Re:resize too large images
Post by: Seph|roth on September 15, 2003, 04:33:02 PM
the mod created by anguz is fine enough... :P

uses CSS to only display an area.. but.. is better as a mod...
that's another good option...

I thought this feature was already in even YaBB SE...?

Max width/height... makes your forum intolerably slow... ring any bells?

-[Unknown]
well, if you take a look at the forum i listed in my initial post, you'll see that is does indeed take some time to load, but that's just because most pages over there have like 10+ large images to load... The resizing itself doesn't seem to take that long...

Plus, you have to realize that an average page does not contain that much large images... not by far, so i don't really see a problem in loading times here... maybe the technique used in YSE was a bit inefficient? (although i have never seen it with my own eyes in YSE.. )

Anyway, i think most people wouldn't mind the minimal extra loading time.. for the sake of readability ;) ANY webdesigner knows that the worst thing a webpage can contain are horizontal scrollbars.. it's just not-done.

My conclusion: I'd REALLY appreciate it if one of the dev's would implement such a feature in SMF, as an admin option.
Title: Re:resize too large images
Post by: Ben_S on September 15, 2003, 04:35:15 PM
I thought this feature was already in even YaBB SE...?

Max width/height... makes your forum intolerably slow... ring any bells?


Could it not be done at initial post time, have it check the size of images between the img tags and if they are bigger than an admin definable size, change the image tag to have a width height attribute proportonally. Yes the whole image would be downloaded but at least it wouldnt mess up the look of the forum?
Title: Re:resize too large images
Post by: Brian Lacy on September 15, 2003, 07:48:15 PM
I thought this feature was already in even YaBB SE...?

Max width/height... makes your forum intolerably slow... ring any bells?

Could it not be done at initial post time, have it check the size of images between the img tags and if they are bigger than an admin definable size, change the image tag to have a width height attribute proportonally. Yes the whole image would be downloaded but at least it wouldnt mess up the look of the forum?

Ben: Hm, didn't think of that.. How compatible is that with browsers besides IE?

Unknown: I guess I thought that was just for avatars.
Title: Re:resize too large images
Post by: Cerberus on September 18, 2003, 01:05:25 PM
imagemagick... or GD, which is pretty common nowadays... most hosts have it installed.
but not on windows  ???
Title: Re:resize too large images
Post by: Seph|roth on September 18, 2003, 01:26:00 PM
imagemagick... or GD, which is pretty common nowadays... most hosts have it installed.
but not on windows  ???
that's just too bad for those l*s*rs ;D ... they will have to live with large images then... ;)

But it's not done using GD or imagemagick or netpbm anyway.. php can handle this on it's own i think...
Title: Re:resize too large images
Post by: Cerberus on September 18, 2003, 02:13:47 PM
unfortunately I have to use windows :(
Title: Re:resize too large images
Post by: [Unknown] on September 19, 2003, 12:52:15 AM
Unfortunately I do my development on windows.

-[Unknown]
Title: Re:resize too large images
Post by: Omar Bazavilvazo on September 19, 2003, 12:08:48 PM
you can use imagemagick in windows, they have binaries for Win32 :)
Title: Re:resize too large images
Post by: Jack.R.Abbit™ on September 19, 2003, 02:09:06 PM
I've not tried it but it seems as though this function getimagesize (http://www.php.net/manual/en/function.getimagesize.php) would do it.  I don't know the performance hit it would cause.
Title: Re:resize too large images
Post by: [Unknown] on September 19, 2003, 09:52:46 PM
That's what the already available mod option does.  That's why it's soo slow.

-[Unknown]
Title: Re:resize too large images
Post by: Jack.R.Abbit™ on September 20, 2003, 03:58:32 AM
Is it slow only when used on a URL or even when used on local file?  I can imagine it being slow on a URL since it basically needs to request the image an then examine it.
Title: Re:resize too large images
Post by: dschwab9 on September 20, 2003, 04:37:38 AM
imagemagick... or GD, which is pretty common nowadays... most hosts have it installed.
but not on windows  ???

GD and Imagemagick can both be installed on windows.
Title: Re:resize too large images
Post by: [Unknown] on September 20, 2003, 11:03:06 AM
Local files are a lot better, but it's really not practical to download every posted picture unless you have 20+ gigs of free space.

-[Unknown]
Title: Re:resize too large images
Post by: Seph|roth on September 20, 2003, 11:58:12 AM
i do ;)
Title: Re:resize too large images
Post by: [Unknown] on September 20, 2003, 12:50:27 PM
Well, that's why it's a MOD and not a thing for all the people (99%) who have < 1 gig space.

-[Unknown]