#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    17
    Rep Power
    0
    I got a script that is supposed to display
    a JPG image from the database, but, instead
    of displaying the image, it displays the JPG
    binary output with those alphanumeric
    characters.

    Coule this be a Header MIMI type problem in my script?

    thanks

    ToolJob

    Sorry but didnt have access to script when
    I wrote this
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    You'll have to set a header that way the browser knows a jpg image is coming to it.

    I can't remember the syntax, but you use the header() function, then echo your $blob data.

    There are tutorials on this all over the place.

    ---John Holmes...
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    7
    Rep Power
    0
    try this as the header info .....
    <?

    header("Content-type: image/jpg");

    //then maybe

    echo "$Binary_blob";

    //as John Holmes suggested

    ?>

    that will let the browser know the MIME before you throw your jpg up there....
    hope that helps
    ccbcreg

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by SepodatiCreations:
    You'll have to set a header that way the browser knows a jpg image is coming to it.

    I can't remember the syntax, but you use the header() function, then echo your $blob data.

    There are tutorials on this all over the place.

    ---John Holmes...
    [/quote]



    [This message has been edited by ccbcreg (edited November 20, 2000).]
  6. #4
  7. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    From what I've picked up, you have a seperate file that just sets the header for the image and echos the data. You reference it like this:

    <img src="make_pic.php?id=345">

    Assuming your pic is referenced by a unique id. then the make_pic.php page will pull out the blob data, set the header, and echo the data.

    Are there other ways to do this?

    ---John Holmes...

IMN logo majestic logo threadwatch logo seochat tools logo