📄 act.slt.asp
字号:
objImage.LoadImage FileName
Select Case CInt(MarkPosition)
Case 1
Position = 3
Case 2
Position = 5
Case 3
Position = 1
Case 4
Position = 6
Case 5
Position = 8
End Select
If MarkTranspColor <> "" Then
MarkTranspColor = "&H" & Mid(MarkTranspColor, 7) & Mid(MarkTranspColor, 5, 2) & Mid(MarkTranspColor, 3, 2)
objImage.AddWaterMark Server.MapPath(MarkPicture), Position, CSng(MarkOpacity), CLng(MarkTranspColor)
Else
objImage.AddWaterMark Server.MapPath(MarkPicture), Position, CSng(MarkOpacity)
End If
objImage.SaveImage 0, objImage.ImageFormat, FileName
End Select
Set objImage = Nothing
Set objMark = Nothing
End Function
Function GetPostion(MarkPosition, x, y, ImageWidth, ImageHeight, MarkWidth, MarkHeight)
Select Case CInt(MarkPosition)
Case 1
x = 1
y = 1
Case 2
x = 1
y = Int(ImageHeight - MarkHeight - 1)
Case 3
x = Int((ImageWidth - MarkWidth) / 2)
y = Int((ImageHeight - MarkHeight) / 2)
Case 4
x = Int(ImageWidth - MarkWidth - 1)
y = 1
Case 5
x = Int(ImageWidth - MarkWidth - 1)
y = Int(ImageHeight - MarkHeight - 1)
End Select
End Function
'由原图片根据数据里保存的设置生成缩略图
Function CreateThumbs(FileName, ThumbFileName)
CreateThumbs = False
If WatermarkSetting(0) <> "0" And (Not IsNull(WatermarkSetting(0))) Then
If WatermarkSetting(1) = "0" Then
CreateThumbs = CreateThumb(FileName, CInt(WatermarkSetting(2)), CInt(WatermarkSetting(3)), 0, ThumbFileName)
Else
CreateThumbs = CreateThumb(FileName, 0, 0, CSng(WatermarkSetting(4)), ThumbFileName)
End If
End If
End Function
'由原图片生成指定宽度和高度的缩略图
Function CreateThumb(FileName, Width, Height, Rate, ThumbFileName)
On Error Resume Next
Dim strSql, RsSetting, objImage, iWidth, iHeight, strFileExtName
CreateThumb = False
If IsNull(FileName) Then '如果原图片未指定直接退出
Exit Function
ElseIf FileName = "" Then
Exit Function
End If
If InStr(FileName, ".") <> 0 Then
strFileExtName = LCase(Trim(Mid(FileName, InStrRev(FileName, ".") + 1)))
End If
If strFileExtName <> "jpg" And strFileExtName <> "gif" And strFileExtName <> "bmp" And strFileExtName <> "png" Then '文件不是可用图片则退出
Exit Function
End If
If IsNull(ThumbFileName) Then
Exit Function
ElseIf ThumbFileName = "" Then
Exit Function
End If
If IsNull(Width) Then
Width = 0
ElseIf Width = "" Then
Width = 0
End If
If IsNull(Rate) Then
Rate = 0
ElseIf Rate = "" Then
Rate = 0
End If
If IsNull(Height) Then
Height = 0
ElseIf Height = "" Then
Height = 0
End If
If InStr(FileName, ":") = 0 Then
FileName = Server.MapPath(FileName)
End If
If InStr(ThumbFileName, ":") = 0 Then
ThumbFileName = Server.MapPath(ThumbFileName)
End If
Width = CInt(Width)
Height = CInt(Height)
Rate = CSng(Rate)
Select Case CInt(WatermarkSetting(0))
Case 0
Exit Function
Case 1
If Not ActCMS.IsObjInstalled("Persits.Jpeg") Then
Exit Function
End If
If ActCMS.IsExpired("Persits.Jpeg") Then
Response.Write ("对不起,Persits.Jpeg组件已过期!")
Response.End
End If
Set objImage = Server.CreateObject("Persits.Jpeg")
objImage.Open FileName
If Rate = 0 And (Width <> 0 Or Height <> 0) Then
If Width < objImage.OriginalWidth And Height < objImage.OriginalHeight Then
If Width = 0 And Height <> 0 Then
objImage.Width = objImage.OriginalWidth / objImage.OriginalHeight * Height
objImage.Height = Height
ElseIf Width <> 0 And Height = 0 Then
objImage.Width = Width
objImage.Height = objImage.OriginalHeight / objImage.OriginalWidth * Width
ElseIf Width <> 0 And Height <> 0 Then
objImage.Width = Width
objImage.Height = Height
End If
End If
ElseIf Rate <> 0 Then
objImage.Width = objImage.OriginalWidth * Rate
objImage.Height = objImage.OriginalHeight * Rate
End If
objImage.Save ThumbFileName
Case 2
If Not ActCMS.IsObjInstalled("wsImage.Resize") Then
Exit Function
End If
If ActCMS.IsExpired("wsImage.Resize") Then
Response.Write ("对不起,wsImage.Resize组件已过期!")
Response.End
End If
If strFileExtName = "png" Then
Exit Function
End If
Set objImage = Server.CreateObject("wsImage.Resize")
objImage.LoadSoucePic CStr(FileName)
If Rate = 0 And (Width <> 0 Or Height <> 0) Then
objImage.GetSourceInfo iWidth, iHeight
If Width < iWidth And Height < iHeight Then
If Width = 0 And Height <> 0 Then
objImage.OutputSpic CStr(ThumbFileName), 0, Height, 2
ElseIf Width <> 0 And Height = 0 Then
objImage.OutputSpic CStr(ThumbFileName), Width, 0, 1
ElseIf Width <> 0 And Height <> 0 Then
objImage.OutputSpic CStr(ThumbFileName), Width, Height, 0
Else
objImage.OutputSpic CStr(ThumbFileName), 1, 1, 3
End If
Else
objImage.OutputSpic CStr(ThumbFileName), 1, 1, 3
End If
ElseIf Rate <> 0 Then
objImage.OutputSpic CStr(ThumbFileName), Rate, Rate, 3
Else
objImage.OutputSpic CStr(ThumbFileName), 1, 1, 3
End If
Case 3
If Not ActCMS.IsObjInstalled("SoftArtisans.ImageGen") Then
Exit Function
End If
If ActCMS.IsExpired("SoftArtisans.ImageGen") Then
Response.Write ("对不起,SoftArtisans.ImageGen组件已过期!")
Response.End
End If
Set objImage = Server.CreateObject("SoftArtisans.ImageGen")
objImage.LoadImage FileName
If Rate = 0 And (Width <> 0 Or Height <> 0) Then
If Width < objImage.Width And Height < objImage.Height Then
If Width = 0 And Height <> 0 Then
objImage.CreateThumb , CLng(Height), 0, True
ElseIf Width <> 0 And Height = 0 Then
objImage.CreateThumb CLng(Width), objImage.Height / objImage.Width * Width, 0, False
ElseIf Width <> 0 And Height <> 0 Then
objImage.CreateThumb CLng(Width), CLng(Height), 0, False
End If
End If
ElseIf Rate <> 0 Then
objImage.CreateThumb CLng(objImage.Width * Rate), CLng(objImage.Height * Rate), 0, False
End If
objImage.SaveImage 0, objImage.ImageFormat, ThumbFileName
Case 4
If Not ActCMS.IsObjInstalled("CreatePreviewImage.cGvbox") Then
Exit Function
End If
Set objImage = Server.CreateObject("CreatePreviewImage.cGvbox")
objImage.SetImageFile = FileName
If Rate = 0 And (Width <> 0 Or Height <> 0) Then
objImage.SetPreviewImageSize = Width
ElseIf Rate <> 0 Then
objImage.SetPreviewImageSize = objImage.SetPreviewImageSize * Rate
End If
objImage.SetSavePreviewImagePath = ThumbFileName
If objImage.DoImageProcess = False Then
Exit Function
End If
End Select
CreateThumb = True
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -