Jump to content

andrew_ww

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

andrew_ww's Achievements

Member

Member (2/5)

0

Reputation

  1. I've looked at the output og phpinfo() and it was: register_globals Off Off
  2. Tried your suggestion however the same problem remains.
  3. Hello, I have created a page that uploads a jpeg to a mysql database. This works okay. I am now having trouble getting the data to display as an image. After conducting some research I understand that you must use two webpages to display this type of information. To this effect I have create 2 pages (image.php and getdata.php). I will place the code at the bottom of the page. The actual problem is that the pages will not display the image. All I get is a red cross. The other error check produces this: array(0) { } Any suggestions as to how I can get this to work. (I'm fully aware that the better way to display images is to store the path, however I'm doing this for a specific purpose) Here is the code image.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <img src="getdata.php?id=22" /> </body> </html> <?php // display.php error_reporting(E_ALL); var_dump($_GET); ?> ----------------------------------------------------------------------- getdata.php <?php // SEE AS MUCH INFORMATION AS WE CAN! error_reporting(E_ALL); // CONNECT TO DB (HOW DO WE KNOW THIS IS WORKING?) require_once('connections/hector_mysql.php'); // GET ARG FROM URL - NOTE WE ASSUME IT IS NUMERIC ONLY $id = $_GET["id"]; // CONSTRUCT AND EXECUTE A QUERY, RETRIEVE ALL COLUMNS USING * $query = "SELECT * FROM tbl_image_upload WHERE image_id=$id LIMIT 1"; if (!$result = mysql_query($query)) { echo "<br />ERROR IN $query \n"; echo "<br /> "; echo mysql_errno(); echo mysql_error(); var_dump($_GET); die(); } // GET ACCESS TO LOCAL VARIABLES $row = mysql_fetch_assoc($result); $data = $row["image"]; $type = $row["image_type"]; // SPEW THE IMAGE Header( "Content-type: $type"); Header( "Content-type: image/pjpeg"); echo $data; exit; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.