hi,

I pipe jpegs from database to browser with following code, if picking
up only one photo, it works perfect, if more than one, then you can
see photos are overlapping each other as one, any idea why that
happens? thanks.

code in route:

exports.get_jpeg = function(req, res){
        dao.loadJpegFromDB(req.params.itemno, function(strm){
                res.writeHead(200, { "Content-Type": "image/jpeg", 
"Content-Length":
102400
                                });
                strm.resume()
                strm.pipe(res)
        })

code in dao:

exports.loadJpegFromDB = function(itemno, func) {
        var sql = 'select picture from item where itemno = ' +
itemno.toString()
        var blob = con.querySync(sql).fetchSync("all",false)[0][0];
        func(new fb.Stream(blob))

ejs:

<img src="/get_jpeg/1" height="480px"></img><br/>
<img src="/get_jpeg/2"  height="480px"></img><br/>
<img src="/get_jpeg/3" height="480px"></img><br/>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to