Free! - Thumbnail and watermark images on the fly with ASP.NET

7956 Users read it.
by Bill Graham

This is a very easy and effective way to display watermarked and thumbnailed images from a folder on your server. It is based on an original piece of code from 4 Guys at Rolla, with image quality interpolation and watermarking added.

User Rating (6 votes)
0 reviews available
User Level:Intermediate
Technologies:.NET

Download the watermarked_thumbnail.aspx file and stick it on your server.

Change the strWatermark text to whatever text you want. This measures the text length for positioning in the image.

Change the lines below:

g.DrawString("DMXZone", wmFont, shadowBrush, 75, (imageHeight * .5) - 36) g.DrawString("DMXZone", wmFont, letterBrush, 77, (imageHeight * .5) - 38)

Put your desired text (same as strWatermark text) fordrawing the watermark. Use the co-ordinates to finely adjust the text position if required.

On the page you want to display the thumbnailed image, call the image from the watermarked_thumbnail.aspx file like this:

<img src="watermarked_thumbnail.aspx?img=<%=(ImageRecordset.Fields.Item("IMAGE NAME").Value)%>")  />

Where the IMAGE NAME is yourimage.jpg (this will only work for jpg files)

On the watermarked_thumbnail.aspx page, enter the desired image width (the height will be calculated automatically to preserve the image ratio) and the watermark text.

Enter the path to your images folder. If you are selling images from your site, put the images folder above the root and use a physical path e.g E:\domains\yoursite\MyImages\. The path to the folder will not be visible to the site visitor.

Follow us on twitter Subscribe to our RSS feed
Activate your free membership today | Login | Currency