How to send images from a COM control/ASP?

Hi,

I am re-designing a legacy ActiveX control. Our goal is to make it usable in
legacy applications as well as in ASP pages.

We have an interface funciton like this:

STDMETHODIMP CXXXCtrl::ExportImage(VARIANT Destination, ImageFormatEnum
ImageFormat)

Now the first parameter can only point to a file. In theory, users can save
the image into the web space then pass to browser; however, this is
obviousely not practically if a web site has thounsands of visitors at the
same time.

Is it possible to pass the Response object into the first parameter?

Anyone can give me some suggestions... appreciated.

Sherwood




0
6/24/2004 8:47:17 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
514 Views

Similar Articles

[PageSpeed] 48

I don't know how one can answer this question without better understanding
your requirements.

How big are these images? 1K? 1 MB? larger? How are they intended to be
used? For display inside the browser? For downloading to the "My Pictures"
folder for slide shows? Are these images expected to be accessible from
users on the Internet (and possible through firewalls)?

> In theory, users can save
> the image into the web space then pass to browser

I don't understand what you mean by this. Can you explain better?

Brian



0
bmuth1 (55)
6/24/2004 10:14:35 PM
OK. For the image part it is really simple. I just want to find a way to
send images to the browser without letting the control saving to the disk
first.

Dim object
Set object = Server.CreateObject("XXX.XXCtrl")
object.Property1 = XXX
object.Save file_name, format_JPG

My question is, is it possible to write
object.Save Response, format_JPG

In the save Method, call
Response.ContentType = "images/jpeg"
Response.BinaryWrite data

The images generated is usually not big, around 10K ~ 50K for JPEG format.

Sherwood

"Brian Muth" <bmuth@mvps.org> wrote in message
news:OkhSjijWEHA.3640@TK2MSFTNGP11.phx.gbl...
> I don't know how one can answer this question without better understanding
> your requirements.
>
> How big are these images? 1K? 1 MB? larger? How are they intended to be
> used? For display inside the browser? For downloading to the "My Pictures"
> folder for slide shows? Are these images expected to be accessible from
> users on the Internet (and possible through firewalls)?
>
> > In theory, users can save
> > the image into the web space then pass to browser
>
> I don't understand what you mean by this. Can you explain better?
>
> Brian
>
>
>


0
jen.lo (2)
6/24/2004 10:25:50 PM
I have to admit I've never thought of firing out an image in this manner,
but I don't see why this wouldn't work. Hopefully someone else will
corroborate this...

Rather than going through the ASP interpreter to obtain the image, I would
probably prefer writing an ISAPI extension. This definitely will work in
terms of generating the appropriate content and mime type, and can
instantiate the COM object for the help it needs in generating the binary
data. This would certainly perform better since the ASP interpreter is cut
out of the picture.

HTH

Brian




0
bmuth1 (55)
6/24/2004 10:41:18 PM
check out this link.
http://www.codeproject.com/asp/downloader.asp

-- 

Suhredayan
Omniquad Ltd.
http://www.omniquad.com
email:suhredayan@gmail.com








"Brian Muth" <bmuth@mvps.org> wrote in message
news:u5RmexjWEHA.2844@TK2MSFTNGP12.phx.gbl...
> I have to admit I've never thought of firing out an image in this manner,
> but I don't see why this wouldn't work. Hopefully someone else will
> corroborate this...
>
> Rather than going through the ASP interpreter to obtain the image, I would
> probably prefer writing an ISAPI extension. This definitely will work in
> terms of generating the appropriate content and mime type, and can
> instantiate the COM object for the help it needs in generating the binary
> data. This would certainly perform better since the ASP interpreter is cut
> out of the picture.
>
> HTH
>
> Brian
>
>
>
>


0
suhredayan (24)
6/25/2004 6:57:54 AM
Sherwood Hu wrote:

> Hi,
> 
> I am re-designing a legacy ActiveX control. Our goal is to make it usable
> in legacy applications as well as in ASP pages.
> 
> We have an interface funciton like this:
> 
> STDMETHODIMP CXXXCtrl::ExportImage(VARIANT Destination, ImageFormatEnum
> ImageFormat)
> 
> Now the first parameter can only point to a file. In theory, users can
> save the image into the web space then pass to browser; however, this is
> obviousely not practically if a web site has thounsands of visitors at the
> same time.
> 
> Is it possible to pass the Response object into the first parameter?
> 
> Anyone can give me some suggestions... appreciated.
> 
> Sherwood

Hi Sherwood,

I think I know what U want, because I have exactly the same problem.
My atl-com-exe sends jpg-data, at the moment still only in a BSTR, which
works fine with perl as the requesting script language and should work with
php because they both use typeless variables by default, but I still don't
know why, the php comm handler does only receive the data until the first
0. - So only perl works with the binary data in a BSTR.
ASP won't work with the data in a BSTR because BSTR is it's default
string-Type (As far as I know) and stops receiving the data also at the
first 0 in the binary data.

As U I want possibly all languages to have easy access to the imagedata.

Right now, I'm still trying to find out if sending the data in a Safearray
or as a byteref would be the better way. - These seem to be the both
possible solutions.

Unfortunately I didn't find one real example for this right now and only
know one not open source programm which does that.
And unfortunately I'm not very experienced with win datatypes, so this will
take me some hard tries ;-(
If you know how to pack the imagedata into the Safearray, it would be very
kind If you could let me know of some examplecode.

A few words to the software solution:
I decided to not embed the solution as an ActiveX Control so users may
disable ActiveX for security reasons. And I decided not to write a Server
dll, because an error occuring in the dll would break down the whole
Server. Another thought was: How often will it be called? Often enought so
a server variant would be neccessary?

There are some very good articles at www.codeproject.com about these topics!

    yours Henri

-- 
|  Henri Schom�cker  -  VIRTUAL HOMES
| Datendesign f�r Internet und Intranet
|      http://www.byteconcepts.de
|      http://www.virtual-homes.de
0
hs2931 (1)
7/18/2004 9:35:12 AM
Reply:

Similar Artilces: