473,769 Members | 6,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image from memory

Is there a posibility to make web control, that is drawing an image to
webpage without needing to save it into a file?
(for example, i will save picture into db server and I want to show it
without saving it into file on file system)

Thanks
Mar 1 '06 #1
10 2148
It's prety easy...if you do:

<img src="someImage. aspx" />

you can then goto someImage.aspx and get the contents from the database and
write them directly to the Response.Output Stream.

You can probably simply get the blob of data into a byte[] array and output
it using Response.WriteB inary.. make sure to call REsponse.Clear( ) and set
the proper content-type :)

Karl

--
http://www.openmymind.net/

"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:eK******** ******@TK2MSFTN GP11.phx.gbl...
Is there a posibility to make web control, that is drawing an image to
webpage without needing to save it into a file?
(for example, i will save picture into db server and I want to show it
without saving it into file on file system)

Thanks

Mar 1 '06 #2
well, but in this case i need an page "someImage.aspx "... but I need make it
as webcontrol.dll. It will looks like image, but the source cannot be an
URL, but an memory stream. Is it possible???

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
It's prety easy...if you do:

<img src="someImage. aspx" />

you can then goto someImage.aspx and get the contents from the database
and write them directly to the Response.Output Stream.

You can probably simply get the blob of data into a byte[] array and
output it using Response.WriteB inary.. make sure to call REsponse.Clear( )
and set the proper content-type :)

Karl

--
http://www.openmymind.net/

"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:eK******** ******@TK2MSFTN GP11.phx.gbl...
Is there a posibility to make web control, that is drawing an image to
webpage without needing to save it into a file?
(for example, i will save picture into db server and I want to show it
without saving it into file on file system)

Thanks


Mar 1 '06 #3
Not 100% sure what you are asking. If you want to stream an image to a
browser, it needs to be in a separate request. If you page is text, and you
want to have an image in there, you need an image tag..you can't mix plain
text and binary data within a single response.

If your only concern is that the code needs to be inside an assembly instead
of a page, your best solution is probably to build an HttpHandler.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:ur******** ******@TK2MSFTN GP12.phx.gbl...
well, but in this case i need an page "someImage.aspx "... but I need make
it as webcontrol.dll. It will looks like image, but the source cannot be
an URL, but an memory stream. Is it possible???

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
It's prety easy...if you do:

<img src="someImage. aspx" />

you can then goto someImage.aspx and get the contents from the database
and write them directly to the Response.Output Stream.

You can probably simply get the blob of data into a byte[] array and
output it using Response.WriteB inary.. make sure to call REsponse.Clear( )
and set the proper content-type :)

Karl

--
http://www.openmymind.net/

"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:eK******** ******@TK2MSFTN GP11.phx.gbl...
Is there a posibility to make web control, that is drawing an image to
webpage without needing to save it into a file?
(for example, i will save picture into db server and I want to show it
without saving it into file on file system)

Thanks



Mar 1 '06 #4
My idea is:

1) to create an dll, that will contain my WebControl (as for example
asp:button is)
2) I will able (and users that will have this dll referenced) to put the
control into page (as asp:button) and it will draw own face, without
needings to refer into an saved bitmap..

Do you understand this?

Thanks for help.

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Not 100% sure what you are asking. If you want to stream an image to a
browser, it needs to be in a separate request. If you page is text, and
you want to have an image in there, you need an image tag..you can't mix
plain text and binary data within a single response.

If your only concern is that the code needs to be inside an assembly
instead of a page, your best solution is probably to build an HttpHandler.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:ur******** ******@TK2MSFTN GP12.phx.gbl...
well, but in this case i need an page "someImage.aspx "... but I need make
it as webcontrol.dll. It will looks like image, but the source cannot be
an URL, but an memory stream. Is it possible???

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
It's prety easy...if you do:

<img src="someImage. aspx" />

you can then goto someImage.aspx and get the contents from the database
and write them directly to the Response.Output Stream.

You can probably simply get the blob of data into a byte[] array and
output it using Response.WriteB inary.. make sure to call
REsponse.Clear( ) and set the proper content-type :)

Karl

--
http://www.openmymind.net/

"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:eK******** ******@TK2MSFTN GP11.phx.gbl...
Is there a posibility to make web control, that is drawing an image to
webpage without needing to save it into a file?
(for example, i will save picture into db server and I want to show it
without saving it into file on file system)

Thanks



Mar 1 '06 #5
well, adding an image to a button is done via the image attribute

<buton image="blah.gif " />

you can do

<button image="imageGen erator.aspx?dat abaseId=3" />
so you could create a button control

public class ButtonImage : Button
{
private int _databaseId;
public int DataBaseId
{
get {return _databaseId; }
set {_databaseId = value; }
}

protected override Render(HtmlText Writer writer)
{
base.Attributes .Add("image", "imageGenerator .aspx?databaseI d=" +
_databaseId.ToS tring());
base.Render(wri ter);
}
}

then all that's left is to build imageGenerator. aspx (you can have this as
an htthandler that's in your dll instead of an actual page) ,that reads the
databaseId from the querystring and gets the right image

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
My idea is:

1) to create an dll, that will contain my WebControl (as for example
asp:button is)
2) I will able (and users that will have this dll referenced) to put the
control into page (as asp:button) and it will draw own face, without
needings to refer into an saved bitmap..

Do you understand this?

Thanks for help.

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Not 100% sure what you are asking. If you want to stream an image to a
browser, it needs to be in a separate request. If you page is text, and
you want to have an image in there, you need an image tag..you can't mix
plain text and binary data within a single response.

If your only concern is that the code needs to be inside an assembly
instead of a page, your best solution is probably to build an
HttpHandler.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:ur******** ******@TK2MSFTN GP12.phx.gbl...
well, but in this case i need an page "someImage.aspx "... but I need
make it as webcontrol.dll. It will looks like image, but the source
cannot be an URL, but an memory stream. Is it possible???

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
It's prety easy...if you do:

<img src="someImage. aspx" />

you can then goto someImage.aspx and get the contents from the database
and write them directly to the Response.Output Stream.

You can probably simply get the blob of data into a byte[] array and
output it using Response.WriteB inary.. make sure to call
REsponse.Clear( ) and set the proper content-type :)

Karl

--
http://www.openmymind.net/

"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:eK******** ******@TK2MSFTN GP11.phx.gbl...
> Is there a posibility to make web control, that is drawing an image to
> webpage without needing to save it into a file?
> (for example, i will save picture into db server and I want to show it
> without saving it into file on file system)
>
> Thanks
>



Mar 1 '06 #6
Hi Mirek,

For static resources like text file, script files or images, we can embed
them into assembly's resource stream(through the embeded resource compile
option in VS IDE). Then, we can use Assembly.GetXXX Stream to get them at
runtime. Are you using ASP.NET 1.1OR 2.0. For ASP.NET 1.1, since you will
need to display the image in your webcontrol, we have to provide another
httphandler or page which writeout the image stream so that our
webcontrol's html content can reference it ( src=xxx). If you're using
ASP.NET 2.0, there comes a new feature called embeded webresource and a
built-in webresource.axd handler than can help retrieve resource stream
from assembly, here are some web articles discussing on this:

#WebResource ASP.NET 2.0 explained
http://www.codeproject.com/aspnet/MyWebResourceProj.asp

#Embedding Resources in ASP.NET 2.0 Assemblies
http://aspalliance.com/726

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 2 '06 #7
Thanks for reply, it will be helpful for my other projects.

Maybe I have to better explain what I want to do. I created a dll, that
contains only one object - HistogramGenera tor. The user (developer) can put
only two parameters there (SourceImagePat h and DestinationImag ePath)
where... SourceImagePath is Image, you want to analyze and you want to
generate its histogram for. DestinationImag ePath is path for the histogram
image that has been generated from source image.

I would like to make it as webcontrol, that is able to live alone, without
needings to write the generated histogram picture into disk. Developer will
put there only the sourceImagePath and control will generate itself as
histogram image.

Maybe Im wrong in thinking about possibilities of this technology. My
question is: Am I able to show image that I previously generated into memory
on the page without needings object asp:image and src="somepage.a spx"??? If
yes, what is the best way. If not, is there posibilities to ask IIS server
for an temporaly location, that i can use for saving the generated images
and I can be sure that this location is writable. (I would like the users of
my control have no problems with using of this control)
Thanks for help.

"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:tM******** ********@TK2MSF TNGXA03.phx.gbl ...
Hi Mirek,

For static resources like text file, script files or images, we can embed
them into assembly's resource stream(through the embeded resource compile
option in VS IDE). Then, we can use Assembly.GetXXX Stream to get them at
runtime. Are you using ASP.NET 1.1OR 2.0. For ASP.NET 1.1, since you will
need to display the image in your webcontrol, we have to provide another
httphandler or page which writeout the image stream so that our
webcontrol's html content can reference it ( src=xxx). If you're using
ASP.NET 2.0, there comes a new feature called embeded webresource and a
built-in webresource.axd handler than can help retrieve resource stream
from assembly, here are some web articles discussing on this:

#WebResource ASP.NET 2.0 explained
http://www.codeproject.com/aspnet/MyWebResourceProj.asp

#Embedding Resources in ASP.NET 2.0 Assemblies
http://aspalliance.com/726

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 2 '06 #8
No, it isn't possible. The binary output of an image needs to be output in
it's own request. when you have an img="src.jpg" the browser creates a new
GET /src.jpg request and the response is sent separately then the containing
source code. This is how http works and it cannot be changed. If you don't
want anything else rendered on the page, then you can use the main request
for the image. But if you want to do something like:

HELLO!
[IMAGE HERE]
the image here needs to be in it's own separate request/response.

For a temporary location you can simply create a new GUID in .NET and use
that for your filename. These are unique. string fileName =
Guid.NewGuid(). ToString();

Karl

--
http://www.openmymind.net/

"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:eQ******** *****@TK2MSFTNG P14.phx.gbl...
Thanks for reply, it will be helpful for my other projects.

Maybe I have to better explain what I want to do. I created a dll, that
contains only one object - HistogramGenera tor. The user (developer) can
put only two parameters there (SourceImagePat h and DestinationImag ePath)
where... SourceImagePath is Image, you want to analyze and you want to
generate its histogram for. DestinationImag ePath is path for the histogram
image that has been generated from source image.

I would like to make it as webcontrol, that is able to live alone, without
needings to write the generated histogram picture into disk. Developer
will put there only the sourceImagePath and control will generate itself
as histogram image.

Maybe Im wrong in thinking about possibilities of this technology. My
question is: Am I able to show image that I previously generated into
memory on the page without needings object asp:image and
src="somepage.a spx"??? If yes, what is the best way. If not, is there
posibilities to ask IIS server for an temporaly location, that i can use
for saving the generated images and I can be sure that this location is
writable. (I would like the users of my control have no problems with
using of this control)
Thanks for help.

"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:tM******** ********@TK2MSF TNGXA03.phx.gbl ...
Hi Mirek,

For static resources like text file, script files or images, we can embed
them into assembly's resource stream(through the embeded resource compile
option in VS IDE). Then, we can use Assembly.GetXXX Stream to get them at
runtime. Are you using ASP.NET 1.1OR 2.0. For ASP.NET 1.1, since you will
need to display the image in your webcontrol, we have to provide another
httphandler or page which writeout the image stream so that our
webcontrol's html content can reference it ( src=xxx). If you're using
ASP.NET 2.0, there comes a new feature called embeded webresource and a
built-in webresource.axd handler than can help retrieve resource stream
from assembly, here are some web articles discussing on this:

#WebResource ASP.NET 2.0 explained
http://www.codeproject.com/aspnet/MyWebResourceProj.asp

#Embedding Resources in ASP.NET 2.0 Assemblies
http://aspalliance.com/726

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Mar 2 '06 #9
OK, thanks for help.

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
No, it isn't possible. The binary output of an image needs to be output in
it's own request. when you have an img="src.jpg" the browser creates a new
GET /src.jpg request and the response is sent separately then the
containing source code. This is how http works and it cannot be changed.
If you don't want anything else rendered on the page, then you can use the
main request for the image. But if you want to do something like:

HELLO!
[IMAGE HERE]
the image here needs to be in it's own separate request/response.

For a temporary location you can simply create a new GUID in .NET and use
that for your filename. These are unique. string fileName =
Guid.NewGuid(). ToString();

Karl

--
http://www.openmymind.net/

"Mirek Endys" <Mi****@communi ty.nospam> wrote in message
news:eQ******** *****@TK2MSFTNG P14.phx.gbl...
Thanks for reply, it will be helpful for my other projects.

Maybe I have to better explain what I want to do. I created a dll, that
contains only one object - HistogramGenera tor. The user (developer) can
put only two parameters there (SourceImagePat h and DestinationImag ePath)
where... SourceImagePath is Image, you want to analyze and you want to
generate its histogram for. DestinationImag ePath is path for the
histogram image that has been generated from source image.

I would like to make it as webcontrol, that is able to live alone,
without needings to write the generated histogram picture into disk.
Developer will put there only the sourceImagePath and control will
generate itself as histogram image.

Maybe Im wrong in thinking about possibilities of this technology. My
question is: Am I able to show image that I previously generated into
memory on the page without needings object asp:image and
src="somepage.a spx"??? If yes, what is the best way. If not, is there
posibilities to ask IIS server for an temporaly location, that i can use
for saving the generated images and I can be sure that this location is
writable. (I would like the users of my control have no problems with
using of this control)
Thanks for help.

"Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
news:tM******** ********@TK2MSF TNGXA03.phx.gbl ...
Hi Mirek,

For static resources like text file, script files or images, we can
embed
them into assembly's resource stream(through the embeded resource
compile
option in VS IDE). Then, we can use Assembly.GetXXX Stream to get them
at
runtime. Are you using ASP.NET 1.1OR 2.0. For ASP.NET 1.1, since you
will
need to display the image in your webcontrol, we have to provide another
httphandler or page which writeout the image stream so that our
webcontrol's html content can reference it ( src=xxx). If you're using
ASP.NET 2.0, there comes a new feature called embeded webresource and a
built-in webresource.axd handler than can help retrieve resource stream
from assembly, here are some web articles discussing on this:

#WebResource ASP.NET 2.0 explained
http://www.codeproject.com/aspnet/MyWebResourceProj.asp

#Embedding Resources in ASP.NET 2.0 Assemblies
http://aspalliance.com/726

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



Mar 2 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4411
by: John Scott | last post by:
I am storing an image in an SQL database and have one field as an image datatype. I am also using a webservice to transport data. I want to be able to resize the image and pass back a thumbnail image in a byte of what is in the database. I also want to be able to display this image in an <asp:image></asp:image> control. Is there any way to do this? Most of the examples that I've seen have used
8
2615
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical) stuff. The class will behave like a std::vector (copy constructor and assignment create a deep copy), but with 2D indexing. Now I also need a 'view' class that will behave like a reference to an 'image' (can only be constructed from an existing...
12
6190
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small console application in C++ (unmanaged) that uses the DLL above. Now the application, together with the above DLL’s is successfully loading a TIF image file (62992 x 113386 Pixels, Huffman RLE compression, 3200 x 3200 DPI resolution, binary colored (1 Bit Per Pixel), file on disk size 43.08...
7
3400
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
6
2146
by: Patrick Dugan | last post by:
Hello, I'm trying to load different images (icons) into a PictureBox1.Image. The first image loads just fine, but the second image always returns the error "Invalid property used." It doesn't matter what icons are loaded. The first always shows up and any icons after that give me the error. Here is the offending code: The "DestinationPath" variable is the full path and filename of the icon
0
1914
by: Mattia | last post by:
************************************************** Manage image without exhausted memory ************************************************** Hi; I have a big problem. I must create a script that upload an image an then resize it, if width or height are more than 250px. Now, after upload an image (in this example I suppose that it's a JPEG image):
4
3467
by: LT.Ang | last post by:
I am developing an application that possibly opens very large images - bmp, jpeg, tiff. I have 2 questions: Language: C#, VS .NET 2003. 1. When the program opens a BMP image, the amount of memory used seems to be larger for BMP files than JPEGs with the same pixel dimensions. For example, 5200 x 5000 pixels image -- increase in Mem Usage is about 80MB for JPEG, but 200MB for BMP (with Task Manager). The Mem Usage is noted before and...
6
2109
by: comp.lang.php | last post by:
I have an image that's only 100K in size, and I am working with 8mb of memory. If I do this: print_r(ceil((int)ini_get('memory_limit') * 10 * filesize(actual_path("$locationPath/$this->fileName")) / 1000000) . 'M'); // PRINTS OUT "2M" for 2mb ]/PHP] The image itself requires far less than the maximum amount of memory
2
3233
by: bharathv6 | last post by:
i need to do is modify the image in memory like resizing the image in memory etc ... with out saving it disk as i have to return back the image with out saving it disk PIL supports the use of StringIO objects being passed in place of file objects. StringIO objects are binary strings of variable length that are kept in memory so i saved the image in stringio objects the following code does that file = StringIO() image.save(file, "JPEG") ...
1
11089
by: bharathv6 | last post by:
i need to do is modify the image in memory like resizing the image in memory etc ... with out saving it disk as i have to return back the image with out saving it disk PIL supports the use of StringIO objects being passed in place of file objects. StringIO objects are binary strings of variable length that are kept in memory so i saved the image in stringio objects the following code does that for gif image ...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.