FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » Automatic Image Resizing (resize uploaded images.)  () 2 Votes
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Automatic Image Resizing [message #35821] Wed, 14 February 2007 13:42 Go to next message
magli is currently offline  magli   Italy
Messages: 15
Registered: February 2007
Location: Meran, Italy
Karma: 0
Junior Member

First of all, thanks a lot for the forum - I have been using it for a while, and it has been great.

One feature which I would like to see is the ability to resize uploaded images, so that if they are included into a users message, that it does not make the page too wide for the screen.

My users often upload images which are over 1500px wide, and when they include the image in their posts, it screws up the layout of the forum.

I was trying to add the code to do this, but I got a bit lost. I thought I had found the place where I could implement this, in the file: /src/attach.inc.t - but I was mistaken. In fact, even removing that file did not affect the file uploading process on my forum.

Can you maybe point me to the right place?

Many thanks.
Re: Automatic Image Resizing [message #35822 is a reply to message #35821] Wed, 14 February 2007 13:57 Go to previous messageGo to next message
magli is currently offline  magli   Italy
Messages: 15
Registered: February 2007
Location: Meran, Italy
Karma: 0
Junior Member

OK. I think I get it. I have to rebuild my themes after making any changes to the files in /src in order for them to take effect, right?
Re: Automatic Image Resizing [message #35829 is a reply to message #35822] Wed, 14 February 2007 23:15 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
That is correct.

FUDforum Core Developer
Re: Automatic Image Resizing [message #35909 is a reply to message #35821] Tue, 20 February 2007 08:50 Go to previous messageGo to next message
magli is currently offline  magli   Italy
Messages: 15
Registered: February 2007
Location: Meran, Italy
Karma: 0
Junior Member
In case anybody is interested, here is the simple solution I used to automatically resize all my uploaded images:

in the file src/getfile.php.t, before the last line (@readfile($r[2]);), I added:

if ($r[0]=="image/jpeg" || $r[0]=="image/png" || $r[0]=="image/tiff") 
        {
                $size = getimagesize($r[2]);
                if ($size[0]>800) system("mogrify -resize 800 ".$r[2]);
        }


This will make sure that all images (jpeg,png and tiff) which have been uploaded to the forum are resized to a maximum width of 800.

It would probably make more sense to add this code into attach.inc.t, so that the resizing is done when the image is uploaded, instead of when it is viewed - but I want it to resize all the already-uploaded images as well.
Re: Automatic Image Resizing [message #158247 is a reply to message #35909] Thu, 12 February 2009 07:07 Go to previous messageGo to next message
Ð Ð»ÐµÐºÑ ÐµÐ¹ is currently offline  Ð Ð»ÐµÐºÑ ÐµÐ¹   Germany
Messages: 5
Registered: February 2009
Karma: 0
Junior Member
magli wrote on Tue, 20 February 2007 03:50
In case anybody is interested, here is the simple solution I used to automatically resize all my uploaded images:

Big thanks Smile

magli wrote on Tue, 20 February 2007 03:50
It would probably make more sense to add this code into attach.inc.t, so that the resizing is done when the image is uploaded, instead of when it is viewed - but I want it to resize all the already-uploaded images as well.

Why code add to attach.inc.t? Rolling Eyes
Re: Automatic Image Resizing [message #159394 is a reply to message #35821] Fri, 29 May 2009 19:35 Go to previous message
dfgngirl is currently offline  dfgngirl   United States
Messages: 87
Registered: December 2005
Karma: 0
Member
I wonder how to do this for all (uploaded and linked) IMGs in posts?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Newsgroup synchronizing
Next Topic: Anchors
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Dec 03 19:23:41 GMT 2024

Total time taken to generate the page: 0.07519 seconds