Jag har gjort en kod i AspJpeg men upptäckte sedan att det var så att jag var tvungen att använda AspImage. Har lyckats göra om lite till AspImage men lyckas inte hitta hur jag sparar bilden igen.AspJpeg till AspImage
Jag har kollat runt lite och hittar inga bra alternavida koder eller beskrivningar hur jag ska kunna ändra denna kod:<%
Function FixaPictureDate(strTexting)
strTexting = Replace(strTexting,"-","")
strTexting = Replace(strTexting,":","")
strTexting = Replace(strTexting," ","")
FixaPictureDate = strTexting
End Function
Dim Nutid
Dim Jpeg
Dim Height
Dim Width
Set Upload = Server.CreateObject("Persits.Upload")
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Nutid = Now()
Upload.Save Server.MapPath("/gallery_temp/")
For Each File in Upload.Files
If File.ImageType <> "JPG" Then
Response.Write "Du kan endast ladda upp JPEG filer."
File.Delete
Response.End
End If
Jpeg.Open File.Path
If Request("Width") < 640 Then
Height = Request("Height") * 640 / Request("Width")
End If
If Request("Height") < 480 Then
Width = Request("Width") * 480 / Request("Height")
End If
Jpeg.Save Server.MapPath("/gallery/") & "/tumb_" & FixaPictureDate(Nutid) & File.FileName
If Request("Width") <> 80 Then
Height = 80
End If
If Request("Height") <> 80 Then
Width = 80
End If
Jpeg.Save Server.MapPath("/gallery/") & "/" & FixaPictureDate(Nutid) & File.FileName
%>
Published:<br><IMG SRC="gallery/<% = FixaPictureDate(Nutid) & File.FileName %>"><br><br>
Tumb:<IMG SRC="gallery/<% = "tumb_" & FixaPictureDate(Nutid) & File.FileName %>"><br><br>
Orginal:<IMG SRC="gallery_temp/<% = File.FileName %>"><br><br>
<%
Next
%>
Sv: AspJpeg till AspImage
<%
Function FixaPictureDate(strTexting)
strTexting = Replace(strTexting,"-","")
strTexting = Replace(strTexting,":","")
strTexting = Replace(strTexting," ","")
FixaPictureDate = strTexting
End Function
Dim Nutid
Dim Jpeg
Dim Height
Dim Width
Set Upload = Server.CreateObject("Persits.Upload")
' Use AspJpeg to resize image
Set Jpeg = Server.CreateObject("AspImage.Image")
Nutid = Now()
' Capture and save uploaded image to the same directory as script
Upload.Save Server.MapPath("/gallery_temp/")
For Each File in Upload.Files
If File.ImageType <> "JPG" Then
Response.Write "This is not a JPGE image."
File.Delete
Response.End
End If
Jpeg.JPEGQuality = 95
Jpeg.AutoClear = False
Jpeg.LoadImage File.Path
If Jpeg.MaxX < 640 Then
Height = Jpeg.MaxY * 640 / Jpeg.MaxX
End If
If Jpeg.MaxY < 480 Then
Width = Jpeg.Jpeg * 480 / Jpeg.MaxY
End If
Jpeg.ResizeR Width, Height
Jpeg.FileName Server.MapPath("/gallery/") & "/" & FixaPictureDate(Nutid) & File.FileName
If Jpeg.SaveImage Then
Response.Write "Published:<br><IMG alt="""" SRC=""gallery/" & FixaPictureDate(Nutid) & File.FileName & """><br><br>"
Else
Response.Write "Error: " & Chart.Error
End If
Jpeg.LoadImage
If Jpeg.MaxX <> 80 Then
Height = 80
End If
If Jpeg.MaxX <> 80 Then
Width = 80
End If
Jpeg.ResizeR Width, Height
Jpeg.FileName Server.MapPath("/gallery/") & "/tumb_" & FixaPictureDate(Nutid) & File.FileName
If Jpeg.SaveImage Then
Response.Write "Tumb:<IMG alt="""" SRC=""gallery/" & "tumb_" & FixaPictureDate(Nutid) & File.FileName & """><br><br>"
Else
Response.Write "Error: " & Chart.Error
End If
Next
Response.Write "Orginal:<IMG alt="""" SRC=""gallery_temp/" & File.FileName & """><br><br>"
%>
Har fått detta felmeddelande av denna kod:<code>Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'FileName'
/ul2.asp, line 52</code>
Men på denna sida står det att man ska använda koden så :S
http://www.serverobjects.com/comp/Aspimage.htm<%
Set Image = Server.CreateObject("AspImage.Image")
rem Set various font parameters
Image.FontColor = vbBlack
Image.Italic = True
Image.Bold = True
Image.FontName = "Arial"
Image.FontSize = 12
Image.PadSize = 10
rem Calculate how big our text info is and set the image to this size
rem This has to be done since we want to fill the area with a gradient
strMessage = "Welcome to"
Image.MaxX = Image.TextWidth (strMessage)
Image.MaxY = Image.TextHeight (strMessage)
rem Create a one way gradient
Image.GradientOneWay vbRed, vbWhite, 0
rem Print our string to the image
Image.TextOut strMessage, Image.X, Image.Y, false
rem Set the filename and save
Image.FileName = "d:\inetpub\wwwroot\images\msg1.jpg"
if Image.SaveImage then
rem The image was saved so write the <img src> tag out for the browser to pick up
Response.Write "<img src=""/images/msg1.jpg""><br>"
else
rem Something happened and we couldn't save the image so just use an HTML header
rem We need to debug the script and find out what went wrong. See Image.Error for details
Response.Write "<h2>Welcome to</h2>"
end if
%>