I wanted to implement a Image resizer in fckEditor so I fooled around with the code for a little while and got it to work(!) at last.
In filemanager/upload/asp/config.asp, add the following rows:
' You must explicitelly enable this resizer (set it to "True").
Dim ImageResizeIsEnabled
ImageResizeIsEnabled = False
'These variables for the resize function
Dim imageobj, ImageData, iWidth, iHeight, newwidth, newheight, SaveImage
' New max width ( if the image if wider ).
newwidth = 150
in add the following rows after ""
If ( ImageResizeIsEnabled ) Then
' Checkes if the uploaded file is an image
If resourceType = "Image" And InStr(ConfigAllowedExtensions.Item(resourceType), sExtension)> 0 Then
Set imageobj=Server.CreateObject("w3Image.Image")
'Opening the image
ImageData = imageobj.LoadImage( sFilePath )
iWidth=imageobj.width
iHeight=imageobj.height
If iWidth > newwidth Then
newheight = formatnumber(iHeight * (newwidth / iWidth),0)
imageobj.Stretch newwidth, newheight, 4
End If
'Resaving the Image.
SaveImage = imageobj.SaveImage((sFilePath),1, 24)
Set imageobj = Nothing
End If
End If
Note:
At this time I have not made any function how to input a max width on upload.
Maybe someone can help with that?
In filemanager/upload/asp/config.asp, add the following rows:
' You must explicitelly enable this resizer (set it to "True").
Dim ImageResizeIsEnabled
ImageResizeIsEnabled = False
'These variables for the resize function
Dim imageobj, ImageData, iWidth, iHeight, newwidth, newheight, SaveImage
' New max width ( if the image if wider ).
newwidth = 150
in add the following rows after ""
If ( ImageResizeIsEnabled ) Then
' Checkes if the uploaded file is an image
If resourceType = "Image" And InStr(ConfigAllowedExtensions.Item(resourceType), sExtension)> 0 Then
Set imageobj=Server.CreateObject("w3Image.Image")
'Opening the image
ImageData = imageobj.LoadImage( sFilePath )
iWidth=imageobj.width
iHeight=imageobj.height
If iWidth > newwidth Then
newheight = formatnumber(iHeight * (newwidth / iWidth),0)
imageobj.Stretch newwidth, newheight, 4
End If
'Resaving the Image.
SaveImage = imageobj.SaveImage((sFilePath),1, 24)
Set imageobj = Nothing
End If
End If
Note:
At this time I have not made any function how to input a max width on upload.
Maybe someone can help with that?
RE: Implemented: Upload - w3Image resizer for
It is better (i think) if you change the following row:
If resourceType = "Image" And InStr(ConfigAllowedExtensions.Item(resourceType), sExtension)> 0 Then
To:
If resourceType = "Image" And InStr(ConfigAllowedExtensions.Item("Image"), sExtension)> 0 Then
RE: Implemented: Upload - w3Image resizer for
Forgot this
Implement resize code after row:
oUploader.SaveAs "NewFile", sFilePath