Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting border around image

Status
Not open for further replies.

mjd3000

Programmer
Apr 11, 2009
136
0
0
GB
I am reading an image from a database and writing it to the screen. But now I also need to put a border around this image. Here is my code :

public void showSelectedImage(string strEncodedImage)
{
Response.Clear();
Response.ContentType = "image/jpeg";

System.Drawing.Image image = retrieveImage(strEncodedImage);

System.Drawing.Image.GetThumbnailImageAbort dummyCallback;

dummyCallback = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);

System.Drawing.Image thumb;

thumb = image.GetThumbnailImage(1200, 800, dummyCallback, IntPtr.Zero);

thumb.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}

public bool ThumbnailCallback()
{
return false;
}

private System.Drawing.Image retrieveImage(string strEncodedImage)
{
System.Drawing.Image image = null;

byte[] imageData = Convert.FromBase64String(strEncodedImage);

MemoryStream memStream = new MemoryStream(imageData);
image = System.Drawing.Image.FromStream(memStream);

return image;
}

Is it possible to add a border to this image?
 
I have done this differently in the past. I used a generic handler(.ashx). In that file, I stream the image from the DB. Then, that gets put into the src of the image tag.
Code:
<img id="" src="<%# "Path to handler" + "/YourHandler.ashx %>" height="106" width="81" alt="" [b]style="border-style: none;"[/b]/>
 
putting a border on the image can be done through CSS.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top