|
-
Oct 8th, 2002, 11:13 AM
#1
Thread Starter
Hyperactive Member
Database image retreival incomplete *RESOLVED*
Hello ppl,
I have a problem, ofcourse else I wouldn't start a tread. *sigh*
Anyway, I've created a PHP script that uploads an image. This image is handled and strored in the MySQL database. This works, and I know that because when I laod my Graphical MySQL Front application I can see the whole image in the 'BLOB' field.
Nou, my php retreives this image from the database and should display it on my website. The problem is I get only half the image, the rest is collored green, red and blue. What is wrong here? How can I fix this?
My image.php:
Code:
<?php
$NewsID = $_REQUEST['NewsID'];
Include("DbData.inc");
$db = mysql_connect($DbUrl, $DbUserName, $DbPwd);
mysql_select_db($DbName,$db);
$result = mysql_query("SELECT NewsImageType, NewsImageSize, NewsImageName, NewsImageData FROM News WHERE NewsID=$NewsID",$db);
$myrow = mysql_fetch_array($result);
header("Content-type: ".$myrow["NewsImageType"]);
header("Content-length: ".$myrow["NewsImageSize"]);
header("X-Image-ID: ".$myrow["NewsImageName"]);
echo $myrow["NewsImageData"];
?>
The DbData.Inc is the file where the connection settings reside... And connecting to the database works OK everywhere else.
I call this image: echo "<p><IMG SRC=image.php?NewsID=".$SubjectName."></p>";
I get only half my image back... 
Can anyone please help me out here?
Thank you for your time...
Last edited by BShadow; Oct 8th, 2002 at 04:04 PM.
"Experience is something you don't get until just after you need it."
-
Oct 8th, 2002, 03:46 PM
#2
Stuck in the 80s
Don't store images in a database. That's not a good idea at all.
Instead, store the images in an image folder and store the location of the image in the database.
-
Oct 8th, 2002, 03:49 PM
#3
Thread Starter
Hyperactive Member
What are the pro's and cons?
"Experience is something you don't get until just after you need it."
-
Oct 8th, 2002, 03:50 PM
#4
Thread Starter
Hyperactive Member
Originally posted by The Hobo
Don't store images in a database. That's not a good idea at all.
Instead, store the images in an image folder and store the location of the image in the database.
Not storing in a database is more easy though 
Hmm...
"Experience is something you don't get until just after you need it."
-
Oct 8th, 2002, 03:54 PM
#5
Stuck in the 80s
If it's easier, then why do it the other way.
Storing images in your database will make it huge fast. Just browse through this forum and you can find many threads discussing the pro's and con's of it.
-
Oct 8th, 2002, 04:04 PM
#6
Thread Starter
Hyperactive Member
Originally posted by The Hobo
If it's easier, then why do it the other way.
Storing images in your database will make it huge fast. Just browse through this forum and you can find many threads discussing the pro's and con's of it.
Thank you, I think you've already convinced me to not doe the databse thing... and you're right about the huge thing 
Thank you very much.
"Experience is something you don't get until just after you need it."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|