sputnik577
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by sputnik577
-
-
so now i've changed the attribute to mediumblob and i'm not getting anything.
I don't know what else to do.
Greg -
i've tried that, i've made the attribute a varchar and that would point to the file but the server said it could not find the image on the server.
-
How can i load a picture from a mySQL database using php. The picture is uploaded in a table and then dynamically loaded to a php page. It's attribute in the database table is longblob.
[code]while(list($name, $type, $size, $path) = mysql_fetch_array($imgResult))
{
$im = open_image($path);
if ($im === false) {
die ('Unable to open image');
}
header ('Content-Type: image/jpeg');
imagejpeg($path);
echo 'Opened image';
function open_image($path) {
# JPEG:
$im = @imagecreatefromjpeg($path);
if ($im !== false) { return $im; }
# GIF:
$im = @imagecreatefromgif($path);
if ($im !== false) { return $im; }
# PNG:
$im = @imagecreatefrompng($path);
if ($im !== false) { return $im; }
# GD File:
$im = @imagecreatefromgd($path);
if ($im !== false) { return $im; }
# GD2 File:
$im = @imagecreatefromgd2($path);
if ($im !== false) { return $im; }
# WBMP:
$im = @imagecreatefromwbmp($path);
if ($im !== false) { return $im; }
# XBM:
$im = @imagecreatefromxbm($path);
if ($im !== false) { return $im; }
# XPM:
$im = @imagecreatefromxpm($path);
if ($im !== false) { return $im; }
# Try and load from string:
$im = @imagecreatefromstring(file_get_contents($path));
if ($im !== false) { return $im; }
return false;
}[/code]
trying to load images from mySQL
in PHP Coding Help
Posted