473,890 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.QuerySt ring("AttachID" )

Dim objConn, objRS, strSQL

adoconnectstr = "Driver={SQ L
Server};databas e=faxmakerarchi ve;Server=XXXX; uid=XXXX;pwd=XX X;CommandTimeou t
= 180"
set objCon = server.CreateOb ject("ADODB.Con nection")
set objRec = server.CreateOb ject("ADODB.Rec ordset")

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

Response.Conten tType = "image/tiff"
'Response.Conte ntType = "applicatio n/pdf"

Response.Binary Write objrec("attdata ")

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

TIA!!
Jul 7 '06 #1
3 5834

"CD" <mc****@hotmail .REMOVETHIS.com wrote in message
news:OG******** ******@TK2MSFTN GP05.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.QuerySt ring("AttachID" )

Dim objConn, objRS, strSQL

adoconnectstr = "Driver={SQ L
Server};databas e=faxmakerarchi ve;Server=XXXX; uid=XXXX;pwd=XX X;CommandTimeou t
= 180"
First, you should use the OLEDB provider instead of ODBC. (Use
"Provider=SQLOL EDB;" in place of "Driver=... ")

set objCon = server.CreateOb ject("ADODB.Con nection")
set objRec = server.CreateOb ject("ADODB.Rec ordset")

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

Response.Conten tType = "image/tiff"
'Response.Conte ntType = "applicatio n/pdf"

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

Set s = Server.CreateOb ject("ADODB.Str eam")
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.Conten tType = "image/tiff"
Response.Binary Write 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******@spamf romyou.comwrote in message
news:em******** ******@TK2MSFTN GP03.phx.gbl...
>
"CD" <mc****@hotmail .REMOVETHIS.com wrote in message
news:OG******** ******@TK2MSFTN GP05.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.QuerySt ring("AttachID" )

Dim objConn, objRS, strSQL

adoconnectst r = "Driver={SQ L
Server};databa se=faxmakerarch ive;Server=XXXX ;uid=XXXX;pwd=X XX;CommandTimeo ut
= 180"

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

>set objCon = server.CreateOb ject("ADODB.Con nection")
set objRec = server.CreateOb ject("ADODB.Rec ordset")

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

Response.Conten tType = "image/tiff"
'Response.Conte ntType = "applicatio n/pdf"

Response.Binary Write objrec("attdata ")

Does that work? I use this:

Set s = Server.CreateOb ject("ADODB.Str eam")
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.Conten tType = "image/tiff"
Response.Binary Write 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******@spamf romyou.comwrote in message
news:em******** ******@TK2MSFTN GP03.phx.gbl...
>
"CD" <mc****@hotmail .REMOVETHIS.com wrote in message
news:OG******** ******@TK2MSFTN GP05.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.QuerySt ring("AttachID" )

Dim objConn, objRS, strSQL

adoconnectst r = "Driver={SQ L
Server};databa se=faxmakerarch ive;Server=XXXX ;uid=XXXX;pwd=X XX;CommandTimeo ut
= 180"

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

>set objCon = server.CreateOb ject("ADODB.Con nection")
set objRec = server.CreateOb ject("ADODB.Rec ordset")

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

Response.Conten tType = "image/tiff"
'Response.Conte ntType = "applicatio n/pdf"

Response.Binary Write objrec("attdata ")

Does that work? I use this:

Set s = Server.CreateOb ject("ADODB.Str eam")
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.Conten tType = "image/tiff"
Response.Binary Write 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
6194
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" name="UpFileName" STYLE="{Width:400px}"><BR>
2
13985
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 attachment and either double click or "view in browser" in order to view it. (It is an attachment after all).... When they DO open Internet Explorer (is all I need, not netscape), a single image appears with some appended text.
6
2978
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 in a TIFF format. What comes back to the screen is garble.... Can anyone help? Thanks The code I am using is: SqlConnection myConn = new SqlConnection(ConfigurationSettings.AppSettings);
0
1098
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 any other image type, but, when I run into the tiff I get a generic gdi+ error. How do you send the entire tiff image to the response.outputstream??? TIA,
4
3025
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 type colum with the variable length of 26 bytes. This is the first time I ran into such way of storing multiple selections in a single Image data type. Is this a better alternative than to store into a One-to-Many tables? If so then I'll have...
4
7175
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 serialize the data to put the array into the cookie. That part of my code is working just fine and displaying fine. The problem I’m having is when I try to unserialize and display; the data does not appear. If I remove my unserialize command line (see...
2
9498
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 my own code all I get is an empty widget. What is wrong with the following program? from Tkinter import *
2
5590
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 that polls my server for updated image data. I would like to use AJAX to fetch the image data, and then use javascript to update the IMG data to show the new picture. This needs to work in IE and Firefox. I've seen a few similar posts, but no...
3
4333
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 currently have a SP that that return the default photo and other relative information. Several of my developers want to retrieve only the image column from this SP. So I thought Id create a function that would execute code very similar to the SP...
0
9978
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
9819
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
10811
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10919
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
10461
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9625
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
7169
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
5846
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...
3
3275
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.