Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DIsplay image(bytea) from postgresql with php
- $conn = pg_pconnect("dbname=test user=postgres password=postgres");
- $temp = '/home/postgres/tmp.jpg';
- $query = "select lo_export(image, '$temp') from map ";
- $result = pg_query($query);
- if($result)
- {
- while ($line = pg_fetch_array($result))
- {
- $ctobj = $line["image"];
- echo "<IMG SRC=show.php> </br>";
- }
- }
- else { echo "File does not exists."; }
- pg_close($conn);
- header("Content-type: image/jpeg");
- $jpeg = fopen("/home/postgres/tmp.jpg","r");
- $image = fread($jpeg,filesize("/home/postgres/tmp.jpg"));
- echo $image;
Add Comment
Please, Sign In to add comment