473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 5787

"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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.