Display image problem??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abhilash Etikala
    New Member
    • Jan 2010
    • 21

    Display image problem??

    I am having a problem in displaying the image. Image is stored perfectly but not able to retrieve and display...i tried to knowledge but still not able to get it..

    my code is:
    display.php
    Code:
     
    <img src="displayimg.php?co=<?php echo $t;?>">
    \\$t is some id value i am sending to displayimg.php
    displayimg.php
    Code:
     
    <?php
             $cpno=$_GET['co'];
     
             require_once('../includes/DbConnector.php');
            $connector = new DbConnector();
            $resim=$connector->query1("select img from image where compno=$1",array($cpno));
             $im1=$connector->fetchArray($resim);
             $data=pg_unescape_bytea(($im1[0]));
           
    
              header('Content-type: image/jpeg');
      echo $im1[0];
           
      ?>
    store.php
    code which i used to store image is..
    Code:
     $data = file_get_contents($newname);
    $imgdata =pg_escape_bytea($data);
     require_once('../includes/DbConnector.php');
            $connector = new DbConnector();
            $connector->query1("INSERT INTO image VALUES($1,$2)",array($row[0],$imgdata));
    I am able to insert the data in to the table but not able to retrieve and display it..
    i am sure that there is no syntactical parse errors..but my questions are...
    Did i went any thing wrong in inserting??
    Is there any setting in php.ini or httpd.conf files to display??
    Please suggest me if i went wrong at any point...
Working...