Forum Moderators: coopster
testbrowse.php
<?php
header("content-type: image/jpg") ;
include("connect.php");
$query = "SELECT uploaded_photo FROM photo";
$results = mysql_query($query) or die(mysql_error()) ;
echo $row['uploaded_photo'] ;
?>
and the page that calls this page image.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<img src = "testbrowse.php" />
</body>
</html>
it simply comes up as the broken picture (box with red x inside) and was hoping someone might catch one of the mistakes i made.
Uploaded_photo is the column field which holds the blob and photo is the table name that contains name, type, photo blob, photo id. I simply just want it to output the picture of the first blob. Thanks in advance for any help.
<?php
header("content-type: image/jpg") ;
include("connect.php");
$query = "SELECT uploaded_photo FROM photo";
$results = mysql_query($query) or die(mysql_error()) ;
// need to fetch the array to get this line to work:
$row = mysql_fetch_assoc($results);
echo $row['uploaded_photo'] ;
?>
-sned
The link to see what the page produces is :
<snip>
[edited by: eelixduppy at 10:03 pm (utc) on Mar. 6, 2007]
[edit reason] no URLS, please-See Terms of Service [/edit]
imagejpeg($row['uploaded_photo']);
-sned
i tried adding that code however upon reading the documentation i found it has to take a value from a image create function. I created the code below with that in mind. When i load the page on my web server and try to access it, it says
Warning: Cannot modify header information - headers already sent by (output started at /home/welsh/public_html/testbrowse.php:14) in /home/welsh/public_html/testbrowse.php on line 17
then the ascii and binary code below that.
my new code is below:
<?php
header("content-type: image/jpg") ;
include("connect.php");
$query = "SELECT uploaded_photo FROM photo";
$results = mysql_query($query) or die(mysql_error()) ;
// need to fetch the array to get this line to work:
$row = mysql_fetch_assoc($results);
$news = ImageCreateFromString($row['uploaded_photo']) ;
$final = imagejpeg($news);
echo $final;
?>
Any Suggestions? I appreciate all your help, this has just been so frustrating for me and it's nice to know there is help out there.
I got the header error to go away however it is still showing as a broken link picture. my code is below:
<?
include("imgheader.php") ;
?>
<html>
<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<?php
include("connect.php");
$query = "SELECT uploaded_photo FROM photo";
$results = mysql_query($query) or die(mysql_error()) ;
// need to fetch the array to get this line to work:
$row = mysql_fetch_assoc($results);
$news = ImageCreateFromString($row['uploaded_photo']) ;
$final = imagejpeg($news);
echo $final;
?>