Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: pod and images

by LanX (Saint)
on Dec 08, 2008 at 19:05 UTC ( [id://729010]=note: print w/replies, xml ) Need Help??


in reply to pod and images

There is an inline image format supported by many mail readers and even browsers! It is base64 encoded. You've certainly seen this in in plain mail texts.

But what you'll need is to realize a POD-Parser transforming it in HTML or PDF.

References:

  1. http://www.google.com/search?q=inline+image+base64
  2. Sending Inline Images in e-mail with Mail::Sender (or getting them to print in Outlook)

Cheers Rolf

Replies are listed 'Best First'.
Inline images in POD
by LanX (Saint) on Dec 09, 2008 at 01:56 UTC
    I was interested and fiddled abou it. And this seems to work without any extra podparser.

    Download this code to pod_img.pl

    for (1.10) { print; } =for html <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAY +AAAAeP4ixAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAA +CxMBAJqcGAAAAAd0SU1FB9gEEgIJDgjXTxYAAAE3SURBVGje7VhBDsMwCAPU/3+ZXbdKC +RDMlLRwjJBqg4lpWFWVioOZqz9BQg+JxxC5bhKAaWAkWVVloGS1pXWEtKJSYfB19C2VqB +QlqXetJDE7DxOxwCLIWGA9ZAQBMkPGW3Er7/m3VrTKK13xdsOT3z5yDJGoR6x4SnRdmeW +/Q1reKmcc3tsVK0+yIBFrigXSQ1YyFQev/Zzp2FU5zNXD3z6yc3C/orS0mshcvkRUPiN/ +GMOW1nbx4+xKwFdAGvzNMeHuYqV+aTxDWlGpIKV4l0pUipLR+3AOUCRm5+EfKwMshIwF1 +kFGECBTZJwVt/Je8BwUrPJSVzS4Hk3y20eOIRL1iCVPia4rk/x3SMtb5ZTDe7ti5EkWJG +RNscg4yEqm4tBdawTW2bGrdJirh799ZOPoV5Td4gPKYZdm2PperwAAAABJRU5ErkJggg= +=" title="img-tag, normal" alt="Inlineimage"> print "dummycode";
    and call
    pod2html pod_img.pl >pod_img.html
    the resulting html-file shows an image in most modern browsers! (Officially also in IE7, but I couldn't test it! So please tell me if ...)

    PLEASE NOTE: The image data is in one long line, the linebreaks were inserted by the perlmonks-formatter.

    Cheers Rolf

      How did you create the src string?

      "data:image/png;base64,iVBORw0K...=="

        Hi

        See URI::data - URI that contains immediate data

        #!/usr/bin/perl -- use strict; use warnings; use URI; use IO::File; my $u = URI->new("data:"); $u->data(join '', IO::File->new( 'camel.favicon.png' , '<:raw' )->getl +ines ); $u->media_type("image/png"); print qq[<p><img src="$u">\n]; __END__ <p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAI +AAADJt1n/AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICE +AAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAKdJREFUOE/Fk2sOgCAMg/HqxpuZe +C1sqI5ReSh/JATB7Os6HkuMMUw3wNMttMhjP7Z16+vWYWDWO3yGUTgAG5mZvcVfMIMAIA +4jd9D4AWwAJYj5Q6jyWrO3yjkL8TD+cKmwVC6w2SlgaH3qCpfGmlrpRl6xt/v0ZXKbVL2 +8hc1LTnVLV2z7zGLkucy7bdo+SDKLtMK+SKl8nFngD5nnz7n/bgcP4wf4BN5NffCErP3u +AAAAAElFTkSuQmCC">

        FWIW, new questions go in Seekers Of Perl Wisdom

        Welcome, see The Perl Monks Guide to the Monastery, see How do I post a question effectively?, Where should I post X?

        3 years ago?

        I think I simply mailed it to myself and copied the base64 encoding.

        Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2024-04-18 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found