Page that sends jpg stream

  • Thread starter Thread starter M K
  • Start date Start date
M

M K

Our production software (which works with images) has an
internal webserver operating on port 80. This resides in
within our firewall. It processes scripts (kpl scripts)
that generate an image. So on our intranet if we have an
image tag with a src
of '//internalServer/render/script.kpl?Value1=2341' the
image appears on the page. That is because the browser on
the intranet makes a call to the internalServer and the
script in question, and reads the jpg file streamed back.
However, we have customers that we want to be able to see
these generated images. They cannot use, nor do we want
them to, the src I mentioned above.
Can I write an aspx page that I can pass as the src for
the image instead, but will pull the image from the script?

The production software company says it is permitted, but
do not have information on how to do it. The webserver is
in a DMZ, but can access the internalServer.
 
You can make the src=somepage.aspx. The aspx file can accept querystrings.
Your page would contain
something like the following

mynewimage = code to get the image from disk and maybe modify it then
Response.ContentType = "image/jpeg"
mynewimage.Save(Response.OutputStream, ImageFormat.Jpeg)

where mynewimage is a system.drawing.image

For example this get the image from disk and adjusts the size

Function mgAdjustBitmap(strFile as string, intHorz as integer, intVert as
integer) as bitmap

Dim mysize as size = new size(inthorz,intVert)
Dim myBitmap As bitmap = New Bitmap(strFile)
myBitmap = new bitmap(mybitmap,mysize)
return myBitmap
End Function
 
Back
Top