rendering images from a database

Discussion in 'Perl Misc' started by ccc31807, Nov 3, 2009.

  1. ccc31807

    ccc31807 Guest

    If you have a table in a database with an ID field (int), name
    (varchar), a content-type field (varchar) and a data field (blob), and
    you have binary data in the data field (like GIFs, JPEGs, PDFs, etc.),
    you can display these directly in a new HTML page. A query from the
    the database returns this:
    id => 666
    name => greg.jpg
    content-type => image/jpeg
    data => &w`l *� m :��mF�΄�A�4d��

    How would you embed this data in an HTML page with a Content-Type of
    text/html? The <img> element needs a src attribute, which I don't
    have, and the <object> element likewise needs a URI for the data
    attribute.

    I can certainly display the "data" from the database, but it's
    character based data (clubs, diamonds, hearts, and spades) rather than
    the nice, pretty picture that's really there. Is there a PM that can
    take a binary and turn it into something that will look like an image
    in a browser?

    Thanks, CC.
    ccc31807, Nov 3, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VGlt?=
    Replies:
    1
    Views:
    336
    WizyDig
    Dec 1, 2004
  2. =?Utf-8?B?RXJpYw==?=

    Rendering in-memory images from UNC file share

    =?Utf-8?B?RXJpYw==?=, Aug 18, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    533
    =?Utf-8?B?RXJpYw==?=
    Aug 18, 2005
  3. Sriram
    Replies:
    0
    Views:
    360
    Sriram
    Sep 11, 2003
  4. Peter Mount
    Replies:
    4
    Views:
    929
    Peter Mount
    Jan 31, 2006
  5. Blasting Cap
    Replies:
    1
    Views:
    298
    bruce barker \(sqlwork.com\)
    Oct 25, 2006
Loading...

Share This Page