ASP AspJpeg pictures To add image watermark code

Source: Internet
Author: User

Picture watermark
' Intdirection: Picture location:
' If the array (left,top) is passed in:
' Left ' indicates the X-directional distance of the watermark picture relative to the upper-right corner of the source graph
' Top indicates the distance from the upper-left Y-direction of the watermark picture relative to the source graph
' If it is a single digit:
' 1: Upper left 2: Upper 3: Top 4: Left Middle 5: Middle 6: Right Middle 7: Left Lower 8: Lower 9, lower right
' strFileName: The filename used as a watermark picture
Public Sub DrawImage (intdirection,strfilename)
Dim objjpeg2
Dim intwidth
Dim intheight
Dim intleft
Dim inttop

Message = ""
If Fileisopen Then
If Objfso.fileexists (Server.MapPath (strFileName)) Then
On Error Resume Next
Set objjpeg2 = Server.CreateObject ("Persits.jpeg")
With OBJJPEG2
. Open Server.MapPath (strFileName)
If Err Then
message = Err.Description
End If
If Intjpegwidth = 0 or intjpegheight = 0 Then
Intwidth =. OriginalWidth
Intheight =. OriginalHeight
Else
Intwidth = Intjpegwidth
Intheight = Intjpegheight
End If
If Intwidth<width and IntheightIf not IsArray (intdirection) Then
Select Case Intdirection
Case 1
Intleft = 0
Inttop = 0
Case 2
Intleft = (width-intwidth)/2
Inttop = 0
Case 3
Intleft = Width-intwidth
Inttop = 0
Case 4
Intleft = 0
Inttop = (height-intheight)/2
Case 5
Intleft = (width-intwidth)/2
Inttop = (height-intheight)/2
Case 6
Intleft = Width-intwidth
Inttop = (height-intheight)/2
Case 7
Intleft = 0
Inttop = Height-intheight
Case 8
Intleft = (width-intwidth)/2
Inttop = Height-intheight
Case Else
Intleft = Width-intwidth
Inttop = Height-intheight
End Select
Else
Intleft = intdirection (0)
Inttop = intdirection (1)
End If
On Error Resume Next
Objjpeg.drawimage Intleft,inttop,objjpeg2,floatjpegopacity,intjpegcolor
If Err Then
Message = "There is an error in playing a picture Watermark!" "
End If
Else
message = "watermark picture pixel too large!" "
End If
End With
Else
message = "Watermark picture does not exist!" "
End If
Else
Message = "File not open!" "
End If
End Sub
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.