G
Guest
Hi there,
I'm trying to read an animated gif from a url (for a banner-rotator). The
code I have now, does read the gif (or jpg), but the result is that I only
get the first frame of the animated gif, AND at a much lower quality :-(
Important to note is that the image is read from a url (from a different
server), and thus NOT from the local disk.
Below is the code I use:
//col[0] = the redirect-url
//col[1] = the image-url
string url = col[1].ToString();
WebClient wc = new WebClient();
Stream st = wc.OpenRead(url);
Bitmap bm = new Bitmap(st);
try
{
HttpResponse response = HttpContext.Current.Response ;
response.ClearContent();
response.ContentType = "image/GIF";
bm.Save(response.OutputStream, ImageFormat.Gif);
}
catch (Exception j)
{
Response.Write(j.Message);
}
st.Close();
What am I doing wrong ? Where should I alter it?
Any help is highly appreciated !!!
Tx in advance.
Greetingz,
Koen Hoorelbeke
(e-mail address removed)
I'm trying to read an animated gif from a url (for a banner-rotator). The
code I have now, does read the gif (or jpg), but the result is that I only
get the first frame of the animated gif, AND at a much lower quality :-(
Important to note is that the image is read from a url (from a different
server), and thus NOT from the local disk.
Below is the code I use:
//col[0] = the redirect-url
//col[1] = the image-url
string url = col[1].ToString();
WebClient wc = new WebClient();
Stream st = wc.OpenRead(url);
Bitmap bm = new Bitmap(st);
try
{
HttpResponse response = HttpContext.Current.Response ;
response.ClearContent();
response.ContentType = "image/GIF";
bm.Save(response.OutputStream, ImageFormat.Gif);
}
catch (Exception j)
{
Response.Write(j.Message);
}
st.Close();
What am I doing wrong ? Where should I alter it?
Any help is highly appreciated !!!
Tx in advance.
Greetingz,
Koen Hoorelbeke
(e-mail address removed)