Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Inline images in POD

by dpchrist (Initiate)
on Nov 17, 2011 at 04:12 UTC ( [id://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?

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

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

    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?

      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 http://en.wikipedia.org/wiki/Data_URI_scheme for a good overview.

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

      Alexander

      --
      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 (Saint) 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-19 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found