Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: blob output

by choroba (Cardinal)
on Sep 11, 2018 at 08:16 UTC ( [id://1222120]=note: print w/replies, xml ) Need Help??


in reply to Re^2: blob output
in thread blob output

> 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,

Replies are listed 'Best First'.
Re^4: blob output
by bigup401 (Pilgrim) on Sep 11, 2018 at 08:36 UTC

    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.

        yah i got u. maybe i never stored binary data instead stored only photo name

        let me fix and see

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1222120]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-20 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found