I had a play today and put together this mod to downsize images uploaded whilst posting a topic or uploaded via FileManager.
Resize Images on uploadMod Version: 0.9
WWF Version: 9.63
Mod Download: Download Zipped Functions_Upload.asp Here
Mod Author: TonyM
Release Date: 12th Nov 2009
Updated: N/AInstallation:Download and extract the Functions_Upload.asp file to the Functions subdirectory of your forum (Backup/Rename the old file first so you can revert to it later if you wish)
That's it!
Alternatively edit the file yourself using the code example below
Requirements:ASPupload and ASPjPeg need to be installed on your WebServer (they are installed by default on Web Wizing)
Overview:Basically if an image is larger than 640 pixels in width I resize it to 640 and maintain the current aspect ratio. All tested files uploaded end up significantly smaller (including those smaller than 640px wide) which is great for saving space and bandwidth.
I also changed the max image upload in forum settings to 2mb as the files are resized upon upload, although you can obviously set that to whatever you like.
In \functions\functions_upload.asp
after this code (approx line 170)
'Get the file name strNewFileName = .Files(1).ExtractFileName]
|
I inserted this code
If strUploadType = "image" Then 'Dimension variables Dim Jpeg
' Create instance of AspJpeg Set Jpeg = Server.CreateObject("Persits.Jpeg")
'maintain aspect ratio Jpeg.PreserveAspectRatio = True ' Open source image Jpeg.Open .Files(1).path
'shrink if it's greater than 640px wide so it fits nicely on pages If Jpeg.OriginalWidth > 640 Then Jpeg.Width = 640 End If ' Save resized image to disk Jpeg.Save .Files(1).path End If
|
I hope it's of use to someone, I noticed a few other people were asking for this when I was looking to see if it had been done to save me doing it!
If you use it please let me know how you go!
Edited by TonyM - 14 November 2009 at 7:19am