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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a bitmap from a stream display in an image control

Status
Not open for further replies.
Joined
Jun 9, 2006
Messages
159
Location
US
Without saving it to disk first? This is a script I wrote that queries the ITUNES database for album cover art and then recieves a URL with the image URL, and in turn creates a memory stream w/that URL:

Code:
 AlbumArt art = new AlbumArt();
        art.Fetch(txt_Artist.Text, txt_Album.Text);

        MemoryStream memStream = new MemoryStream();

        System.IO.Stream responseStream = art.GetStream();
        Bitmap bmpArt = new Bitmap(responseStream);

        Response.Clear();
        Response.ContentType = "image/jpeg";
        bmpArt.Save(memStream, ImageFormat.Jpeg);
        memStream.WriteTo(Response.OutputStream);

I want to just be able to assign the Image SRC of an image button control this in memory representation of the image. I dont want to give it the image url from itunes.

Shawn Molloy
Seattle, WA
 
Try having a page (say, AlbumImage.aspx) which takes a query string value identifying your image. Then write the image to the response stream as you are.

All that's left is to create an image control in another page and set its image url property to: AlbumImage.aspx?AlbumArtId=whatever or whatever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top