Hi,
I have a site in Ruby on Rails where the images are stored in the MySQL database and Ruby outputs them all fine. Here's one:
http://londonprogressivejournal.com/image/picture/2
The problem is that I want to use the same MySQL blob data in PHP. Now if I retrieve it and use code as so:
<?php
if(isset($_GET['id']) && isset($_GET['type']))
{
// Includes my DB connection info and my definitions for run_query
include('_include_all.php');
$id = $_GET['id'];
$type = $_GET['type']; // table name
$query = "SELECT * FROM `".$type."` WHERE id = %d";
$result = run_query($query, $id);
header("Content-type: ".$result[0]['content_type']);
echo $result[0]['picture'];
}
?>
I get this: http://theogb.com/archive/Iraq.jpg
I've seen this sort of garbage output from the GD on PHP before.
I'm using XAMPP 1.7.0 but I've not had this sort of problem with other image outputs yet.