07-30-2008, 06:37 PM
|
#1 (permalink)
|
|
The Visitor
Join Date: Jul 2008
Location: North Carolina
Posts: 2
Thanks: 0
|
Content- type won't change, dynamic image
Hi, I came across an issue while trying to dyamically change the content-type to the right type for an image
Here is show.php
Code:
<?php
include('inc/db.php');
$id = $_GET['id'] ;
$query = "SELECT imgdata,type FROM pics WHERE id=$id";
$result = MYSQL_QUERY($query);
$data = MYSQL_RESULT($result,0,"imgdata");
$type = MYSQL_RESULT($result,0,"type");
Header( "Content-type: $type ");
echo $data;
?>
and here is the database structure
Code:
CREATE TABLE pics (
id INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
type TEXT,
caption VARCHAR(255),
albumid INT(10) NOT NULL,
imgdata LONGBLOB )
Does anyone see any issues with these?
Any Help would be appreciated,
thanks.
- The issue is it outputs the data as text/plain ,
I failed to mention this previously
__________________
"We are told never to cross a bridge until we come to it, but this world is owned by men who have 'crossed bridges' in their imagination far ahead of the crowd."
|
|
|