כדי להציג תמונה מוקטנת עד השלב לפני שאני קורא לפונקציה: SaveBinaryData
זה עובד מעולה והתמונה מוקטנת. הקטע הוא שאני לא רוצה להקטין אותה באמצעות הדף אלא כקובץ בשרת עצמו. התמונה כבר בשרת, לא צריך להעלות אותה.
השגיאה שמופיעה זה:
ADODB.Stream error '800a0bbc'
Write to file failed.
/simple_resizer3.asp, line 43
מישהו יכול לעזור?
תודה.
PHP קוד:
<%
'***************************************************************************
' e-Kov Software Picture Effector 2.7 tutorial script (c) 2001-2004
' Mailto: support@e-Kov.com
' WWW: www.e-Kov.com
' Resample source picture to width 150px
'***************************************************************************
path="/yay.jpg"
Dim Obj, newWidth, newHeight
Set Obj = Server.CreateObject("eKov.PictureEffector")
Obj.LoadFromFile Server.MapPath(Path)
newWidth = 180
newHeight = newWidth * Obj.Height / Obj.Width
Obj.Resize newWidth, newHeight, 5
Obj.Quality = 90
path="/yay2.jpg"
SaveBinaryData Server.MapPath(Path), Obj.GetImageAsJpeg
Set Obj = nothing
Function SaveBinaryData(FileName, ByteArray)
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1
'Create Stream object
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - we want To save binary data.
BinaryStream.Type = adTypeBinary
'Open the stream And write binary data To the object
BinaryStream.Open
BinaryStream.Write ByteArray
'Save binary data To disk
BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
BinaryStream.SaveToFile FileName, adSaveCreateNotExist
End Function
%>