Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Display text and image on same page

by kschwab (Vicar)
on Jan 13, 2019 at 15:09 UTC ( #1228473=note: print w/replies, xml ) Need Help??


in reply to Display text and image on same page

It looks like the image is a graph that changes all the time, so using an inline base64 encoded image might make sense here. Something like:
#!/usr/bin/perl use strict; use warnings; use MIME::Base64 qw(encode_base64url); my $img="/var/www/grafika/graphHour.png"; open(IMG,$img) or die "Can't open $img: $!\n"; my $imgdata; {local $/=undef;$imgdata=<IMG>;} close IMG; my $b64=encode_base64url($imgdata); print "Content-type: text/html\n\n "; print "<html> \n"; print "<head></head>\n"; print "<body>\n"; print "<img src='data:image/png;base64,$b64'>"; print "</body></html>"

Replies are listed 'Best First'.
Re^2: Display text and image on same page
by afoken (Canon) on Jan 14, 2019 at 06:45 UTC
    inline base64 encoded image

    Bad news: Still not supported by all browsers (details). As usual, Microsoft's browser implementations cause trouble.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      It works fine on IE and Edge, since IE9, for this specific use case of the src element of an img tag. The only restriction is that it must be less than 4GB. That's described on the page you linked. There are other limitations for different use cases, but not this one.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2021-09-17 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?