hi @ all!
does anyone know how to resize pictures during upload with classic asp?
i found some solutions for php, but this won´t solve my problem.
for image resizing i normally use ActiveImage from Tonec.com.
my prob is: i don´t know where to put the resizing-code inside the script of the fck-editor upload.
i tried to fire a function for resizing my pics, but fck ignores or overruns it.
here´s my function:
i placed this function inside the "connector.asp".
i tried to fire the function inside "commands.asp".
here´s my code:
i hope someone can help me, also if you have any other solutions for resizing pictures during upload with classic asp!!!
greetz,
stefan
does anyone know how to resize pictures during upload with classic asp?
i found some solutions for php, but this won´t solve my problem.
for image resizing i normally use ActiveImage from Tonec.com.
my prob is: i don´t know where to put the resizing-code inside the script of the fck-editor upload.
i tried to fire a function for resizing my pics, but fck ignores or overruns it.
here´s my function:
Function Resize(strPath, strFile, x, y, strPre, strExt) Dim f_date, f_time, f_jetzt, f_tag, f_monat, f_jahr, f_hour, f_minute, f_second, f_timestamp Dim f_file1, f_file2 Dim h, w, imagewidth, imageheight, maxwidth, maxheight, w1, h1 ' ------------------------------------------------------------------------------ ' Build timestamp ' get date & time f_date = CDate(Date()) f_time = Time() f_jetzt = CDate(Now()) f_tag = Day(x_jetzt) f_monat = Month(x_jetzt) f_jahr = Year(x_jetzt) f_hour = Hour(x_time) f_minute = Minute(x_time) f_second = Second(x_time) ' Timestamp f_timestamp = f_hour & f_minute & f_second & f_tag & f_monat ' ------------------------------------------------------------------------------ ' set filenames f_file1 = strPath & strFile f_file2 = strPath & strPre & f_timestamp & strExt Set im = CreateObject("ActiveImage.Images.1") im.SetImageType 1 im.ReadFromFile f_file1 h = im.GetHeight w = im.GetWidth imagewidth = w ' get original width imageheight = h ' get original height maxwidth = x maxheight = y If (imagewidth > maxwidth) then imageprop = (maxwidth / imagewidth) imagevsize = (imageheight * imageprop) imagewidth = maxwidth imageheight = round(imagevsize, 1) End If If (imageheight > maxheight) then imageprop = (maxheight / imageheight) imagevsize = (imagewidth * imageprop) imageheight = maxheight imagewidth = round(imagevsize, 1) End If w1 = imagewidth h1 = imageheight im.SetImage 1 im.CreateImage CInt(w1),CInt(h1) im.CopyImageResize 1,0,0,0,0,0,CInt(w1),CInt(h1),w,h im.SetJpegQuality 96 im.WriteToFile f_file2 im.DestroyImage im.SetImage 0 Set im = Nothing End Function
i placed this function inside the "connector.asp".
i tried to fire the function inside "commands.asp".
here´s my code:
... ' Save the file Do While ( True ) Dim sFilePath, sPic sFilePath = sServerDir & sFileName If ( oFSO.FileExists( sFilePath ) ) Then iCounter = iCounter + 1 sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension sErrorNumber = "201" Else oUploader.SaveAs "NewFile", sFilePath ' Picture Resizing If LCase(sExtension) = "jpg" Or LCase(sExtension) = "jpeg" then sPic = Resize(sServerDir, sFileName, 150, 150, "thumb_", "." & sExtension) End If If oUploader.ErrNum > 0 Then sErrorNumber = "202" Exit Do End If Loop ...
i hope someone can help me, also if you have any other solutions for resizing pictures during upload with classic asp!!!
greetz,
stefan
Re: image resizing with asp
Re: image resizing with asp
Hi inceebee!
Thanx for your answer!
Here´s one example of a working php plugin:
http://www.saulmade.nl/FCKeditor/FCKPlugins.php
Here´s another example:
http://verens.com/demos/FCKeditor/editor.tbz2
There´s no auto-resize-function - the user has to set the resizing by himself (that is not what i want to do) but there´s another nice feature: if you move your mouse over the filename a context menu appears with a thumbnail and a short info about this pic.
For my sites I need to resize a uploaded pic in three sizes with a minimum resolution of 640x480 pixels:
640x480
125x94
60x45
It would be great if you could convert the examples from php to asp!