I want to display an image on a page with Image control on it.
I know this is very simple but tweak in my case is that image is available as a stream variable (which I am getting as a response from one of the server) instead of physical file.
Eventually I want to create a control for this with some other feature on it.
My question is how to assign "stream" variable to Image control?
Reason I am asking for other approach is that I am trying to build SharePoint web part where lot of other things (web parts) will be there on page so approach suggested by you wont work in my case.
I am trying to develop a web part which will display image stream on web page.
"BASE6 4 and Embbedded Image" appraoch is not very reliable, it's browser dependent. Another issue with it is that it doesn't work properly if image size is big!
No, I don't want to hide src from my users, in fact they only will enter it on the page.
If we Write anything on page by using Response then it will clear all other things from it, which I definitely don't want. As I mentioned earlier, there are several other things on my page and this particular "Image Streamer" is going to be one of those
items.
Is the image stream coming correctly as a finished image from the server url you are requesting it? In that case you can just set the url to the call directly as source on the html image tag. It does not have to be url to a static image file, as long as
the url returns a valid image content stream with correct mime type in the header of the response stream.
Member
91 Points
127 Posts
Display image on web page
Feb 23, 2010 05:03 AM|naimish_hit|LINK
Hi,
I want to display an image on a page with Image control on it.
I know this is very simple but tweak in my case is that image is available as a stream variable (which I am getting as a response from one of the server) instead of physical file.
Eventually I want to create a control for this with some other feature on it.
My question is how to assign "stream" variable to Image control?
Thanks in advance.
ND
Participant
1392 Points
374 Posts
Re: Display image on web page
Feb 24, 2010 04:12 AM|Binary_Fiddle|LINK
I think the below thread will give you a fair idea for solving your problem.
http://forums.asp.net/t/1265564.aspx
This can be beneficial to other community members reading the thread.
Regards,
Amit
Microsoft Certified Technology Specialist (MCTS)
Contributor
6678 Points
2004 Posts
Re: Display image on web page
Feb 24, 2010 04:21 AM|satalaj|LINK
You can refer this http://www.revenmerchantservices.com/page/asp-net-image-upload.aspx
In which format you are getting image from other server ? Is that BASE64 character string ?
Satalaj
Member
91 Points
127 Posts
Re: Display image on web page
Feb 25, 2010 12:14 AM|naimish_hit|LINK
Thanks to both of you.
Is there any other approach to achieve the same?
Reason I am asking for other approach is that I am trying to build SharePoint web part where lot of other things (web parts) will be there on page so approach suggested by you wont work in my case.
I am trying to develop a web part which will display image stream on web page.
Thanks in advance
ND
Contributor
6678 Points
2004 Posts
Re: Display image on web page
Feb 25, 2010 12:21 AM|satalaj|LINK
Are you trying to embed image on web page in the form of BASE64 character string?
Satalaj.
Member
91 Points
127 Posts
Re: Display image on web page
Feb 25, 2010 04:29 AM|naimish_hit|LINK
Not really - It will be like this,
I am stuck on item # 4!
ND
Contributor
6678 Points
2004 Posts
Re: Display image on web page
Feb 25, 2010 04:40 AM|satalaj|LINK
Once you get the image in Binary format, you can convert it into BASE64 string
like this http://www.revenmerchantservices.com/post/2009/09/03/c-binary-to-string.aspx
You can embed this BASE64 stream like this
http://www.sweeting.org/mark/blog/2005/07/12/base64-encoded-images-embedded-in-html
or
http://www.google.co.in/search?sourceid=navclient&ie=UTF-8&rlz=1T4GGIH_enIN268IN268&q=base64+image+embedding
Satalaj
Member
91 Points
127 Posts
Re: Display image on web page
Feb 25, 2010 05:27 AM|naimish_hit|LINK
Satlaj,
"BASE6 4 and Embbedded Image" appraoch is not very reliable, it's browser dependent. Another issue with it is that it doesn't work properly if image size is big!
Anyways thanks for your support.
ND
Contributor
6678 Points
2004 Posts
Re: Display image on web page
Feb 25, 2010 05:47 AM|satalaj|LINK
Do you want to hide the src of image? I mean do you don;t want end user to know from which server you are fetching
the request?
Have you created your Image Handler and its
context.Response.ContentType = "image/gif"; property like this ?
context.Response.BinaryWrite(binaryImage);
Satalaj
Member
91 Points
127 Posts
Re: Display image on web page
Feb 25, 2010 07:42 AM|naimish_hit|LINK
No, I don't want to hide src from my users, in fact they only will enter it on the page.
If we Write anything on page by using Response then it will clear all other things from it, which I definitely don't want. As I mentioned earlier, there are several other things on my page and this particular "Image Streamer" is going to be one of those items.
ND
Member
10 Points
17 Posts
Re: Display image on web page
Mar 11, 2010 09:12 AM|asmund|LINK
Is the image stream coming correctly as a finished image from the server url you are requesting it? In that case you can just set the url to the call directly as source on the html image tag. It does not have to be url to a static image file, as long as the url returns a valid image content stream with correct mime type in the header of the response stream.