DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 13 Aug 2007 16:43:09 -0400,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    MikeB
          2    George Ter-Saakov
          3    Peter Bromberg [C# MVP]
          4    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
          5    MikeB


Set Image Control to Bitmap   
Hello All,  want to be able to pull images from the database and load them 
into a bitmap through a stream which I have working.  I then want to take 
the bitmap and load it into a Image control without haveing to save the 
bitmap as a file.  Is this possible?  Currently, I just display the bitmap 
by calling Bitmap.save however, if users do not know to click the image they 
can not see the full size.  If I can create a bitmap from the stream I know 
the size so I can set the properties of a image control and then display the 
bitmap in the image.  Does this make since or am I going about this the 
wrong way?  So in a nutshell, I am pulling images from a DB and want to 
display the full size without having to actuall save the image to a file. 
Any pointers?

TIA
Date:Mon, 13 Aug 2007 16:43:09 -0400   Author:  

Re: Set Image Control to Bitmap   
You can make an mypage.aspx page that returns bitmap (not HTML)
1. You need to set ContentType = "img/gif"; or (jpg)
2. You need to set ContentLength to the size of the image
3. Use Response.BinaryWrite to output the image.  Or since Response is a 
Stream you can do Bitmap.Save(Response);

in your HTML you write <img src="mypage.aspx">


PS: It's more efficient to use handler for that task. mypage.ashx. But aspx 
will work too if you fill more comfortable with aspx.

George.



"MikeB"  wrote in message 
news:usruSre3HHA.1164@TK2MSFTNGP02.phx.gbl...

> Hello All,  want to be able to pull images from the database and load them 
> into a bitmap through a stream which I have working.  I then want to take 
> the bitmap and load it into a Image control without haveing to save the 
> bitmap as a file.  Is this possible?  Currently, I just display the bitmap 
> by calling Bitmap.save however, if users do not know to click the image 
> they can not see the full size.  If I can create a bitmap from the stream 
> I know the size so I can set the properties of a image control and then 
> display the bitmap in the image.  Does this make since or am I going about 
> this the wrong way?  So in a nutshell, I am pulling images from a DB and 
> want to display the full size without having to actuall save the image to 
> a file. Any pointers?
>
> TIA
> 
Date:Mon, 13 Aug 2007 17:01:49 -0400   Author:  

RE: Set Image Control to Bitmap   
Here is a way to do this without relying on an external handler such as 
another page:

http://www.eggheadcafe.com/articles/20050911.asp

-Peter
Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
BlogMetaFinder:    http://www.blogmetafinder.com



"MikeB" wrote:


> Hello All,  want to be able to pull images from the database and load them 
> into a bitmap through a stream which I have working.  I then want to take 
> the bitmap and load it into a Image control without haveing to save the 
> bitmap as a file.  Is this possible?  Currently, I just display the bitmap 
> by calling Bitmap.save however, if users do not know to click the image they 
> can not see the full size.  If I can create a bitmap from the stream I know 
> the size so I can set the properties of a image control and then display the 
> bitmap in the image.  Does this make since or am I going about this the 
> wrong way?  So in a nutshell, I am pulling images from a DB and want to 
> display the full size without having to actuall save the image to a file. 
> Any pointers?
> 
> TIA 
> 
> 
> 
Date:Mon, 13 Aug 2007 17:02:02 -0700   Author:  

Re: Set Image Control to Bitmap   
Your page can have an Image control on it, and that Image control can point 
to another page (or handler) that retrieves the image.
Here are the details:
http://SteveOrr.net/articles/ImproveYourImages.aspx
http://dotnetslackers.com/articles/aspnet/FileDenial.aspx

-- 
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net



"MikeB"  wrote in message 
news:usruSre3HHA.1164@TK2MSFTNGP02.phx.gbl...

> Hello All,  want to be able to pull images from the database and load them 
> into a bitmap through a stream which I have working.  I then want to take 
> the bitmap and load it into a Image control without haveing to save the 
> bitmap as a file.  Is this possible?  Currently, I just display the bitmap 
> by calling Bitmap.save however, if users do not know to click the image 
> they can not see the full size.  If I can create a bitmap from the stream 
> I know the size so I can set the properties of a image control and then 
> display the bitmap in the image.  Does this make since or am I going about 
> this the wrong way?  So in a nutshell, I am pulling images from a DB and 
> want to display the full size without having to actuall save the image to 
> a file. Any pointers?
>
> TIA
> 
Date:Mon, 13 Aug 2007 16:06:01 -0700   Author:  

Re: Set Image Control to Bitmap   
Thanks everyone for the replies.

"MikeB"  wrote in message 
news:usruSre3HHA.1164@TK2MSFTNGP02.phx.gbl...

> Hello All,  want to be able to pull images from the database and load them 
> into a bitmap through a stream which I have working.  I then want to take 
> the bitmap and load it into a Image control without haveing to save the 
> bitmap as a file.  Is this possible?  Currently, I just display the bitmap 
> by calling Bitmap.save however, if users do not know to click the image 
> they can not see the full size.  If I can create a bitmap from the stream 
> I know the size so I can set the properties of a image control and then 
> display the bitmap in the image.  Does this make since or am I going about 
> this the wrong way?  So in a nutshell, I am pulling images from a DB and 
> want to display the full size without having to actuall save the image to 
> a file. Any pointers?
>
> TIA
> 
Date:Tue, 14 Aug 2007 20:01:23 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us