Menu

Retrieving image data and showing it in brows

Help
Bandorka
2010-10-05
2013-04-22
  • Bandorka

    Bandorka - 2010-10-05

    Hi,

    There is a problem.
    With odbtp , the mssql image field that stores picture data, cannot show picture when retireved with php in a browser:

    $query = 'SELECT picture FROM SHOPPERS_PICTURES WHERE SH_PIC_ID = '.(int)$_REQUEST{'id'};
    $picture = db_getOne($query);
    if (!$picture) {
    die('id = ????');
    }
    header('Content-Type: image/jpeg');
    echo $picture;

    What could be the problem. The data was saved in hexa format.

    Thanks
    B

     
  • Robert Twitty

    Robert Twitty - 2010-10-05

    Is the data in the image field the EXACT binary representation of the JPEG, or is it a hexadecimal character encoded version? Also, you should inclde a Content-Length header entry with value resulting from strlen( $picture ) call.

    • bob
     
  • Bandorka

    Bandorka - 2010-10-05

    Its the hexadecimal data of the image.

     
  • Bandorka

    Bandorka - 2010-10-05

    Bob, you are a genius! The content length solved the problem!!!!

     

Log in to post a comment.