Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: (nrd) Content-type: html and images ?

by newrisedesigns (Curate)
on Feb 10, 2003 at 16:44 UTC ( #234162=note: print w/ replies, xml ) Need Help??


in reply to Content-type: html and images ?

Every page element that is not the HTML of the page requires a seperate request/response. For example, a simple HTML page with two images and a linked CSS requires 4 HTTP connections (one for the page, the CSS, and one for each image).

You could roll the HTML and the image into one script.

Sample page:

<html> <head> <title>This is my page!</title> </head> <body> <p>A line of text</p> <img src="index.pl?image=img01"> </body> </html>

The perl:

use strict; use CGI; my $q = CGI->new(); my $image = $q->param("image") or ''; if($image ne ''){ print $q->header("image/gif"); ## print out the rest of image here } else{ print $q->header(); print $q->start_html("This is my page!"); ## print out HTML here... }

Untested. While you're here... SIGN UP!

John J Reiser
newrisedesigns.com


Comment on Re: (nrd) Content-type: html and images ?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2015-07-30 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls