Results 1 to 6 of 6

Thread: Database image retreival incomplete *RESOLVED*

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425

    Question 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."

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425
    What are the pro's and cons?
    "Experience is something you don't get until just after you need it."

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425
    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."

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425
    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
  •  



Click Here to Expand Forum to Full Width