in reply to Re: blob output
in thread blob output

am just polling photo from db table from blob column

the photo is stored in db not locally. as u see the example. the photo is being polled from db bt cant display i tried to use binmod

well i think it just needs to be decoded to display coz its in encoded type

Replies are listed 'Best First'.
Re^3: blob output
by choroba (Cardinal) on Sep 11, 2018 at 08:16 UTC
    > as u see the example

    No, the example shows the name of the file being inserted into the src attribute of an img tag:

    <img src="02100.JPG">

    You haven't posted the schema of the table nor a sample of it, so I don't know what details you keep for each photo.

    Note that

    <img src="\@\ $ome binary trash, in fact contents of a JPG file">
    doesn't display the image in the browser. The common way is to use
    <img src="data:image/jpg;base64,..."
    where you can use MIME::Base64 to encode the binary contents.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

      i selected the photo from table

      my $pic = $DBH->prepare("SELECT PHOTO FROM tble WHERE ID = ?"); $pic->execute(#ID); $pik = $pic->fetchrow;

      this is my html div where i want to display the img

      html <img src="$pik">

      this is the output. the photo i got from table where is blob column

      u can see the photo was selected successful from table and brings the photo name exactly. bt the problem it doesn;t display to browser

      output <img src="02100.JPG" #this is the photo i got from db. bt cant display +>

        This isn't how it works. 02100.JPG isn't the image data, that's the name of the image. If all you have stored in the database is the filename all your photos will have to be in the same directory as the page being served. Otherwise you'll have to prepend the correct path to this variable. This clearly isn't doing what you seem to think it does. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img.