Home » SQL & PL/SQL » SQL & PL/SQL » Selecting tiff Images from Oracle database (Merged)
Selecting tiff Images from Oracle database (Merged) [message #219934] Fri, 16 February 2007 16:30 Go to next message
gvandekrol
Messages: 8
Registered: February 2007
Junior Member
Good Afternoon,

I'm trying to select a TIFF image from Oracle.
I used the following code, but it shows up a load of funny characters as the result. How do I get it to show up as an image, or give users the option to download the image. I'm pretty new to selecting records from Oracle using PHP.

Any help would be very much appreciated.

<?php

if ($conn=OCILogon("username", "password", "databasename")) {
}
else {
$err = OCIError();
echo "Oracle Connect Error " . $err[text];
exit;
}

$sql = "SELECT * FROM tablename WHERE ID = '123456789' ORDER BY ID";

$stmt = oci_parse($conn, $sql);

oci_execute($stmt)
or die ("Unable to execute query\n");

while ( $row = oci_fetch_assoc($stmt) ) {

$result = $row['DATA']->load()."\n";
}
header("Content-Type: TIFF");
echo $result;
?>

[Updated on: Fri, 16 February 2007 16:31]

Report message to a moderator

Re: Selecting tiff Images from Oracle database [message #220144 is a reply to message #219934] Mon, 19 February 2007 02:50 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
That seems like a problem on how the BROWSER displays the data.

Does it work with "image/tiff" as content-type?
Re: Selecting tiff Images from Oracle database [message #220206 is a reply to message #220144] Mon, 19 February 2007 08:10 Go to previous messageGo to next message
gvandekrol
Messages: 8
Registered: February 2007
Junior Member
Thanks for your answer, it got me one step closer.
If I run the PHP page now, it lets me download the tiff image.
However, when I open the image, it gives me the error: document's format is invalid, or not supported. The image is stored in the database as segments, I think I need to merge these segments somehow.
I'll give it another try, thanks so far.
Putting together segmented images from Oracle using PHP [message #220210 is a reply to message #219934] Mon, 19 February 2007 08:31 Go to previous message
gvandekrol
Messages: 8
Registered: February 2007
Junior Member
Hello,

I'm trying to load an image from an Oracle database using PHP. The problem is, these images are segmented and have to be put back together. I can't find much information on the append() function and I've tried many different ways (time to turn to orafaq.com).

The error returned from PHP is Fatal error: Call to a member function append() on a non-object

Please have a look at the code below.


Any help would be very much appreciated.

<?php

if ($conn=OCILogon("username", "password", "databaseName")) {
}
else {
$err = OCIError();
echo "Oracle Connect Error " . $err[text];
exit;
}

$sql = "SELECT * FROM tableName WHERE ID = '123456789' ORDER BY ID";

$stmt = oci_parse($conn, $sql);

oci_execute($stmt)
or die ("Unable to execute query\n");

while ( $row = oci_fetch_assoc($stmt) ) {

$image = $image->append($row['DATA']);
}

$result = $image->load()."\n";
header("Content-Type: image/tiff");
echo $result;
?>
Previous Topic: Dates between two dates
Next Topic: how can say that truncate is faster than delete......
Goto Forum:
  


Current Time: Sun Dec 04 20:21:18 CST 2016

Total time taken to generate the page: 0.07683 seconds