Ways to add watermarks using AspJpeg

Source: Internet
Author: User
Tags add object save file version

These days, I studied ASP's method of automatically adding image watermark.

Because my picture was always hotlinking, so I used the program to add a watermark to the image, but I looked at yesterday and today's website log records, found that my picture is still hotlinking serious.

Two days, my blog has more than 20 g of access traffic, The picture is located in the directory upload occupied 18.6g,37 million clicks, and the article directory only used 1.3G traffic, 40,000 clicks, from the source, to the large station hotlinking pictures accounted for the largest flow, csdn and Bokee accounted for the top two, the two addresses brought 40,000 times hotlinking.

Of course, I've also wanted to use a program like ISAPI rewrite if I've tried to completely prevent hotlinking, but after I actually used it, I found that ISAPI rewrite all the external links, but I didn't want to disable all of the external links, so I ended up not using them. But if this hotlinking situation continues, I have to consider enabling the ISAPI rewrite program again.

The following is my use of the program to increase the watermark method, although to my current use effect to see, is a comparison of the failure of the case.

Add watermark using a name called AspJpeg ASP components, I was downloaded on Oblog's website, version is 1.5 version, using this image processing component, you can easily make thumbnails of the picture and add watermark for the image function. Here is a brief description of how to use it:

First, on the download page of Oblog, download the AspJpeg v1.5.0.0 in the Oblog related components download, and then execute the downloaded file and install the component.

Then in the ASP code to add a little bit of code can be added position can be placed in the upload image after the completion of the picture address, to modify. For Z-blog users, the watermark function can be realized by copying the following code directly to the end of the upload function in the Tuploadfile class of the c_system_lib.asp file.

1. Add watermark function to picture

Dim Jpeg
Set Jpeg = Server.CreateObject ("persits.jpeg") ' establishes object
Jpeg.open Blogpath & "/upload/" & FileName image location
Jpeg.Canvas.Font.Color = &h000000 ' color, here is set to: Black
Jpeg.Canvas.Font.Family = "founder of the Simplified" ' Set font
Jpeg.Canvas.Font.Bold = False ' is set to bold
Jpeg.Canvas.Font.Size = 26 ' font size
Jpeg.Canvas.Font.Quality = 4 ' Text clarity
Jpeg.Canvas.Print jpeg.originalwidth/2-170,jpeg.originalheight-30, "WWW.WILLIAMLONG.INFO" watermark text
Jpeg.save Blogpath & "/upload/" & filename ' save file
Set Jpeg = Nothing

2. Make thumbnails for pictures

Dim Jpeg
Set Jpeg = Server.CreateObject ("persits.jpeg") ' establishes object
Jpeg.open Blogpath & "/upload/" & FileName image location
Jpeg.width = JPEG.ORIGINALWIDTH/2
Jpeg.height = JPEG.ORIGINALHEIGHT/2
' Set the thumbnail size (this ratio is set to 50%), or give him the exact value, like jpeg.width=120
Jpeg.save Blogpath & "/upload/" & filename ' save file
Set Jpeg = Nothing



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.