Want to retrive one image data in php ,which is stored in bytea format in postgresql?
===

I am new to postgresql.I have one image file stored in postgresql as bytea format,i want to display that image file in browser using php .by googling i found something but not getting e image.

    <?php 
    ini_set('display_errors', '1');
    error_reporting(E_ALL | E_STRICT);
    header('Content-type: image/jpeg');  //act as a jpeg file

    $con = pg_connect("host=$host port=5432 dbname=$db user=$user password=$pass")
    or die ("Could not connect to server\n");
    if(!$con){ echo "not connected";}
    // Get the bytea data
    // pg_query('SET bytea_output = "escape";');
    $res = pg_query("SELECT product_logo FROM product_product WHERE id=156");  
    $row = pg_fetch_array($res);
      $content = $row['product_logo'];

     echo pg_unescape_bytea($content);
     ?>


please give me some idea how to do it.i will be thankful to you