472,354 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Displaying image data from SQL...single/multipart tiff

CD
An application is logging faxes sent in SQL2000 image column type. I have
found code on the net but what it is doing is prompting to save to local
which is fine for single page image. Not good for multiple page faxes. I
have not been able to locate an example to load in the browser or how to
handle multiple image in the one column.

1) Ideally it would be nice to display back in the browser since some may be
multiple images. I am not a programmer but any help is appreciated..

<%
Dim strAttachID
strAttachID = Request.QueryString("AttachID")

Dim objConn, objRS, strSQL

adoconnectstr = "Driver={SQL
Server};database=faxmakerarchive;Server=XXXX;uid=X XXX;pwd=XXX;CommandTimeout
= 180"
set objCon = server.CreateObject("ADODB.Connection")
set objRec = server.CreateObject("ADODB.Recordset")

objCon.Open adoconnectstr
strSQL = "SELECT attdata FROM fm_faxout_att WHERE ID ='" & strAttachID &
"'"
objrec.Open strSQL, objCon

Response.ContentType = "image/tiff"
'Response.ContentType = "application/pdf"

Response.BinaryWrite objrec("attdata")

objrec.Close
Set objrec = Nothing
objCon.Close
Set objCon = Nothing
%>

TIA!!
Jul 7 '06 #1
3 5705

"CD" <mc****@hotmail.REMOVETHIS.comwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
An application is logging faxes sent in SQL2000 image column type. I have
found code on the net but what it is doing is prompting to save to local
which is fine for single page image. Not good for multiple page faxes. I
have not been able to locate an example to load in the browser or how to
handle multiple image in the one column.

1) Ideally it would be nice to display back in the browser since some may
be multiple images. I am not a programmer but any help is appreciated..

<%
Dim strAttachID
strAttachID = Request.QueryString("AttachID")

Dim objConn, objRS, strSQL

adoconnectstr = "Driver={SQL
Server};database=faxmakerarchive;Server=XXXX;uid=X XXX;pwd=XXX;CommandTimeout
= 180"
First, you should use the OLEDB provider instead of ODBC. (Use
"Provider=SQLOLEDB;" in place of "Driver=...")

set objCon = server.CreateObject("ADODB.Connection")
set objRec = server.CreateObject("ADODB.Recordset")

objCon.Open adoconnectstr
strSQL = "SELECT attdata FROM fm_faxout_att WHERE ID ='" & strAttachID &
"'"
objrec.Open strSQL, objCon

Response.ContentType = "image/tiff"
'Response.ContentType = "application/pdf"

Response.BinaryWrite objrec("attdata")
Does that work? I use this:

Set s = Server.CreateObject("ADODB.Stream")
s.Mode = 3
s.Type = 1
s.Open

// write the contents of the blob field to the stream
s.Write objrec("attdata").Value
s.Position = 0

Response.ContentType = "image/tiff"
Response.BinaryWrite s.Read()

You can reuse the stream, just close it and open it again to clear it.

As for multiple images in the same blob, that's a tough one... when you save
a multi-page blob to file, can the file be opened in a normal image viewer?
Maybe it's a single image that spans multiple logical pages? If not, and
multiple image file structures are written to the field back-to-back, you'll
have to separate the images by searching for the file header, signature, or
some other unique feature with which the start of each image might be
located. (It would be much easier to write each image to a different row,
and associate those rows that go together, if you have any control over that
end.)

Given you're able to get valid images out of it, one approach to displaying
multiple pages would be to generate an HTML document with multiple image
tags, one for each page.
-Mark
objrec.Close
Set objrec = Nothing
objCon.Close
Set objCon = Nothing
%>

TIA!!

Jul 9 '06 #2
CD
yes the above works. That is what i am guessing the application is placing
multi image in one row.

thanks for the reply

"Mark J. McGinty" <mm******@spamfromyou.comwrote in message
news:em**************@TK2MSFTNGP03.phx.gbl...
>
"CD" <mc****@hotmail.REMOVETHIS.comwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
>An application is logging faxes sent in SQL2000 image column type. I
have found code on the net but what it is doing is prompting to save to
local which is fine for single page image. Not good for multiple page
faxes. I have not been able to locate an example to load in the browser
or how to handle multiple image in the one column.

1) Ideally it would be nice to display back in the browser since some may
be multiple images. I am not a programmer but any help is appreciated..

<%
Dim strAttachID
strAttachID = Request.QueryString("AttachID")

Dim objConn, objRS, strSQL

adoconnectstr = "Driver={SQL
Server};database=faxmakerarchive;Server=XXXX;uid= XXXX;pwd=XXX;CommandTimeout
= 180"

First, you should use the OLEDB provider instead of ODBC. (Use
"Provider=SQLOLEDB;" in place of "Driver=...")

>set objCon = server.CreateObject("ADODB.Connection")
set objRec = server.CreateObject("ADODB.Recordset")

objCon.Open adoconnectstr
strSQL = "SELECT attdata FROM fm_faxout_att WHERE ID ='" & strAttachID &
"'"
objrec.Open strSQL, objCon

Response.ContentType = "image/tiff"
'Response.ContentType = "application/pdf"

Response.BinaryWrite objrec("attdata")

Does that work? I use this:

Set s = Server.CreateObject("ADODB.Stream")
s.Mode = 3
s.Type = 1
s.Open

// write the contents of the blob field to the stream
s.Write objrec("attdata").Value
s.Position = 0

Response.ContentType = "image/tiff"
Response.BinaryWrite s.Read()

You can reuse the stream, just close it and open it again to clear it.

As for multiple images in the same blob, that's a tough one... when you
save a multi-page blob to file, can the file be opened in a normal image
viewer? Maybe it's a single image that spans multiple logical pages? If
not, and multiple image file structures are written to the field
back-to-back, you'll have to separate the images by searching for the file
header, signature, or some other unique feature with which the start of
each image might be located. (It would be much easier to write each image
to a different row, and associate those rows that go together, if you have
any control over that end.)

Given you're able to get valid images out of it, one approach to
displaying multiple pages would be to generate an HTML document with
multiple image tags, one for each page.
-Mark
> objrec.Close
Set objrec = Nothing
objCon.Close
Set objCon = Nothing
%>

TIA!!


Jul 10 '06 #3
CD
yes the above works. That is what i am guessing the application is placing
multi image in one row.

thanks for the reply

"Mark J. McGinty" <mm******@spamfromyou.comwrote in message
news:em**************@TK2MSFTNGP03.phx.gbl...
>
"CD" <mc****@hotmail.REMOVETHIS.comwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
>An application is logging faxes sent in SQL2000 image column type. I
have found code on the net but what it is doing is prompting to save to
local which is fine for single page image. Not good for multiple page
faxes. I have not been able to locate an example to load in the browser
or how to handle multiple image in the one column.

1) Ideally it would be nice to display back in the browser since some may
be multiple images. I am not a programmer but any help is appreciated..

<%
Dim strAttachID
strAttachID = Request.QueryString("AttachID")

Dim objConn, objRS, strSQL

adoconnectstr = "Driver={SQL
Server};database=faxmakerarchive;Server=XXXX;uid= XXXX;pwd=XXX;CommandTimeout
= 180"

First, you should use the OLEDB provider instead of ODBC. (Use
"Provider=SQLOLEDB;" in place of "Driver=...")

>set objCon = server.CreateObject("ADODB.Connection")
set objRec = server.CreateObject("ADODB.Recordset")

objCon.Open adoconnectstr
strSQL = "SELECT attdata FROM fm_faxout_att WHERE ID ='" & strAttachID &
"'"
objrec.Open strSQL, objCon

Response.ContentType = "image/tiff"
'Response.ContentType = "application/pdf"

Response.BinaryWrite objrec("attdata")

Does that work? I use this:

Set s = Server.CreateObject("ADODB.Stream")
s.Mode = 3
s.Type = 1
s.Open

// write the contents of the blob field to the stream
s.Write objrec("attdata").Value
s.Position = 0

Response.ContentType = "image/tiff"
Response.BinaryWrite s.Read()

You can reuse the stream, just close it and open it again to clear it.

As for multiple images in the same blob, that's a tough one... when you
save a multi-page blob to file, can the file be opened in a normal image
viewer? Maybe it's a single image that spans multiple logical pages? If
not, and multiple image file structures are written to the field
back-to-back, you'll have to separate the images by searching for the file
header, signature, or some other unique feature with which the start of
each image might be located. (It would be much easier to write each image
to a different row, and associate those rows that go together, if you have
any control over that end.)

Given you're able to get valid images out of it, one approach to
displaying multiple pages would be to generate an HTML document with
multiple image tags, one for each page.
-Mark
> objrec.Close
Set objrec = Nothing
objCon.Close
Set objCon = Nothing
%>

TIA!!


Jul 13 '06 #4

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

Similar topics

3
by: Roberto | last post by:
I have the following problem: I have the following form client side: <FORM.......> <FORM action="./WZUpload.asp" method="Post" enctype="multipart/form-data" WIDTH=100%> <INPUT Type="file"...
2
by: Tiro Orsa | last post by:
Hey all... GOAL: My end goal is to send a web page (single file) as an attachment (not embedded) via email to any of the main email clients (Eudora, Outlook, etc). Users see a single web page...
6
by: Phil | last post by:
Hi I have an issue when trying to stream blob image data from a SQL table to a .aspx page. the code I have works for GIF and JPEG but the images can be multiple pages and we would like them to open...
0
by: Jared | last post by:
Please note that I posted in the framework.drawing group as well. Hello all, I want to display multipart tiff images in a web browser using the response.outputstream. I know how to do it with...
4
by: serge | last post by:
I was working on figuring out where a certain application was storing the multiple selection choices I was doing through the app. I finally figured out that they were being store in an IMAGE data...
4
by: MrL8Knight | last post by:
Hello, I am trying to build a simple php form based shopping cart using a cookie with arrays. I need to use 1 cookie because each order will have over 20 items. With that said, I realize I need to...
2
by: sj | last post by:
I am just learning to use Tkinter and am having problems displaying image files. I am able to display an image using tutorials (such as http://www.daniweb.com/code/snippet296.html) But when I try...
2
by: Marcus | last post by:
Here is a toy problem describing what I want to do: I have a web page with a single IMG element (say for a 128 x 128 "screen") which is initially blank (image=black pixels). I have AJAX code...
3
by: =?Utf-8?B?SlA=?= | last post by:
Explanation: We have several SP that need to retrieve a single "Default Photo" from one of several Photo tables. The column in question in these tables is defined as an IMAGE data type. I...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.