Forum Moderators: open
My intent is to display text on the screen which can't be read by spiders & bots.
how could it be done?
- The width is set when you cut the bitmap object but I can't tell you if that will auto wrap. You'll have to give that a try.
- The font is set in the System.Drawing.Font namespace.
- As for feeding the data from elsewhere, just create a database or FileIO call to fecth that data and plug those results in where I hardcoded the email address.
I use this code in a UserControl to display an email address as an image so that spiders don't pick it up:
// Create a bitmap object
Bitmap objBmp = new Bitmap(175, 20);
// Create a graphics object
System.Drawing.Graphics objGraphics = System.Drawing.Graphics.FromImage(objBmp);
// Set the background color to white
objGraphics.Clear(Color.White);
// Render as anti alias for a better quality image
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
// Create a Font object and select a font & size
System.Drawing.Font objFont = new Font("Arial", 10, FontStyle.Regular);
// What's the text that should appear on the image
objGraphics.DrawString("mymail@myaddress.com", objFont, Brushes.Blue, 3, 3);
// Set the content type to gif
Response.ContentType = "image/GIF";
// Stream the image out to the http header
objBmp.Save(Response.OutputStream, ImageFormat.Gif);
// Because were working with the graphics library it's recommended
// practice that we force cleanup to occur.
objFont.Dispose();
objGraphics.Dispose();
objBmp.Dispose();
Our server is indeed .NET, and I have arranged to get some cooperation from the server admin for this... any advice you can give regarding setup is crucial.
Do I need a special DLL library, extension or something?