Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Inline images in POD

by dpchrist (Initiate)
on Nov 17, 2011 at 04:12 UTC ( #938515=note: print w/ replies, xml ) Need Help??

in reply to Inline images in POD
in thread pod and images

How did you create the src string?


Comment on Re: Inline images in POD
Download Code
Replies are listed 'Best First'.
Re^2: Inline images in POD
by Anonymous Monk on Nov 17, 2011 at 07:41 UTC


    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?

      data:-URLs are nice, but they have limits: Old browsers and especially IE<7 can't handle them, IE<9 has some arbitary limits for the data URL length. See for a good overview.

      Base64 encoding can be done from the command line, as documented in MIME::Base64.


      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^2: Inline images in POD
by LanX (Canon) on Nov 17, 2011 at 22:53 UTC
    3 years ago?

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

    Cheers Rolf

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2015-10-13 09:39 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (298 votes), past polls