CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced: Re: [ankit] HOW TO SEE PNG image in browser: Edit Log


Apr 14, 2010, 11:14 PM

Views: 23992
Re: [ankit] HOW TO SEE PNG image in browser

you should not mix text and binary data (image) within single server response. because the browser is not able to process such data. The most simple way to show the image within the html is just printing the refernece to an image. The browser will fetch and place it by itself (with separate request as it always does).

for example if you store your image into some local_path/images/ folder which is visible from web as http://your_host/web_path/images/ and the image name is some_image.png

the code will be following:

print header; # this prints content-type: text/html 


print "Total Fragments of the sequence are: @count \n";
print "</pre></code>\n", hr;

my $img_filename = 'some_image.png';
print "<img src=\"/web_path/images/$img_filename\"><br />";

(This post was edited by roolic on Apr 14, 2010, 11:15 PM)

Edit Log:
Post edited by roolic (User) on Apr 14, 2010, 11:15 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives