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

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.

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.

Overview

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.

Reviews

doesn't work..

December 13, 2005 by Oliviero Dall'Asta
What is ImageRecordset in your code??

about my previous question about ImageRecordset..

December 13, 2005 by Oliviero Dall'Asta
Sorry, I've not realized immediately that yuo were retriving a record from a dataset or something like it...usually I'm working with Visual studio...

recordset

April 27, 2006 by joe mr
followed instructions but no go, "ImageRecordset" is not declared...

Thumbnails & Watermark images on the fly asp.net

January 17, 2007 by Patricia O'Neal

Hello Everyone,

I have just finished the tutorial above
(http://www.dmxzone.com/showdetail.asp?NewsId=10287)
and
have an error that says:

Name 'ImageRecordset' is not declared

Can someone help.

Regards
Pati20005

See all 8 Reviews

You must me logged in to write a review.