http://qs1969.pair.com?node_id=938533


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

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?

Replies are listed 'Best First'.
Re^3: Inline images in POD
by afoken (Chancellor) on Nov 18, 2011 at 10:57 UTC

    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". ;-)