Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with response binarywrite

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
I have a bunch of .asp pages that select image_date from an oracle table. The image_data was a long raw data type. The oracle tables were just update and the image_data is now a BLOB data type. Since the change my .asp pages wont display the image. What changes do i have to make to display my BLOB images?

Set rs = con.Execute("SELECT image_data FROM images where images.active_flag = 'Y' and image_id=" & target)
Response.BinaryWrite rs("image_data")
 
bookouri, change the content type.

Code:
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear

Response.ContentType = "image/gif"

Set rs = con.Execute("SELECT image_data FROM images where images.active_flag = 'Y' and image_id=" & target)
Response.BinaryWrite rs("image_data")
Response.end

Cheers

Nick
 
For unspecific image type, this instead may be useful.
[tt] Response.ContentType = "image/*"[/tt]
 
i tried both ways, and nothing works, but I did notice when testing that images captured before the change that were migrated over to the new tables will still open, while imaged captured directly into the new tables wont?? any ideas what else might be going on???

thanks
 
Sounds like the problem is getting the correct data in rather than pulling it out.
 
yep, but i cant complain to the vendor of the db app, in all our oracle forms and reports the images work just fine, old ones and new ones.. so now im stuck trying to make their "new" format images work :(

 
Is there any difference in the size of the working images vs. the non-working images?

If the ones that don't work are larger you might need to use the .GetChunk method to pull the image out of the DB.
 
i havnt checked that... ill have to take a look and see if i can compare them.

if there's a question, should i just plan on changing to a getchunk method? I dont know how difficult getchunk is to use.. i've never used it anywhere else.

thanks
 
the old images seem to range around 40k and the new ones are 100k+ would those sizes make any difference?

 
I still havnt found out what's wrong here. Ive tried every variation I can find on displaying these images and nothing is working...

 
Load it through a reduced html page, if the blob data is specifically image, see what happens.
[tt]
<html>
<body>
<img src="that-asp-script.asp" alt="binwritten-to"></img>
</body>
</html>
[/tt]
 
When i try that i get a placeholder with an X and binwritten-to displayed next to the X and no image.

 
Then, you have to verify the source. You've placed undue confidence on the blob data.
 
I have managed to export the contents of the blob field and it does appear to be a valid image blob if i pull it up in photoshop.
 
the header of both the working images and the non-working images start out as a JFIF if i pull it up in a text editor.
 
And your actual part of the script related to this is? You've to show it if all we ask you to take care, you have always done right before we ask.
 
These are the methods Ive tried so far:

Set rs = con.Execute("SELECT image_data FROM images where image_id=" & target)
Response.BinaryWrite rs("image_data")


Set rs = con.Execute("SELECT image_data FROM images where image_id=" & target)
size=rs.fields("image_data").actualSize
blob=rs.fields("image_data").getchunk(size)
Response.BinaryWrite rs("image_data")

Well, I have tried both these ways of displaying my images. I put this code in
my image.asp file and call it using <IMG SRC="image.ASP">

Either of these methods will work for images stored before our upgrade but will not work for any images stored after the upgrade.

If I save the contents of the blob column to a text file, the headers of the good file and the bad file look identical with a JFIF header. The "good" file is 17k
the "bad" file is 30k.

Once I have them saved to disk, I can give the files a .jpg extension and open either file using photoshop or paint shop pro and they look fine.

The "good" file is 354x444 pixels, 4.917x6.167 inches, 72 dpi, color depth 24/16million, one layer
The "bad" file is 480x600 pixels, 6.667x8.333 inches, 72 dpi, color depth 24/16million, one layer

I'm at a loss where to go next. I can't see why these new blobs wont work. I have absolutely no control over what the vendor's application stores in the blob, after all it works fine with their application and they're not responsible for fixing my problems..

I'm grasping at straws, maybe switch to a .jsp page or try php, but Ive never worked with either of these and dont know the equivalent code to show my image.


 
response.end is it there? And the set up? Should we trust all those innocent lines are there behind the screen?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top