dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: help me display image from my database..

Hybrid View

  1. #1
    Join Date
    Aug 2012
    Posts
    1

    help me display image from my database..

    can anyone help me display my image coming from my database.. the datatype of the image being uploaded is "image".. I already tried some code base on my research but I only get a broken image or just the raw data coming from the database..

    >Here is the code i used in displaying my image..

    $sql = "SELECT StudentPicture from dbo.ES_Students where StudentNo = '2009100496'";
    $stmt = sqlsrv_query( $conn, $sql );
    if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
    }

    while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
    echo "<br/>";

    $img = $row['StudentPicture'];
    header('Content-Type: image/jpeg');
    echo $img;


    the output of that code is a broken image/invalid image icon..
    thanks in advance for your reply

  2. #2
    Join Date
    Jul 2009
    Posts
    184
    Are you just storing the path to the image in the database, and not the images themselves?

    Hopefully yes, and if so, check that the src attribute of your image tag is properly pointing to where the image file is stored on your server.
    Last edited by WestWeb; 08-30-2012 at 06:21 PM.

  3. #3
    Join Date
    Apr 2013
    Posts
    31
    Hi, I am a newbie here. I wonder whether it can be solved by creating a windows image viewer? I am almost agreen hand on this problem. But I hope yousuccess. Good luck.



    Best regards,
    Arron

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles