[Tutor] Displaying images on a web page

Alan Gauld alan.gauld at btinternet.com
Tue Jan 1 17:48:59 CET 2008


"Dinesh B Vadhia" <dineshbvadhia at hotmail.com> wrote 

> I want to display a fixed number of same-size (jpeg) images 
> on a web page.  The images displayed will change on user input.

Can you be more specific?
Do you mean they should change dynamically in the browser 
or that they will change after a form submission?

In other words is the change done as part of a refresh of the 
page or dynamically within the browser? If its the latter there 
are several JavaScript recipes for doing this usually involving 
caching a set of images and selecting the appropriate one 
in response to user events.

If you mean as part of a server page refresh then normal CGI 
techniques will work. Again if you have a list of images you 
can select the appropriate one.

> I can use PIL to write the code but has anyone come across 
> open source code that already does this?  

I'm not sure where PIIL comes in? Normally PIL would be used 
to create the images before displaying them. What part of the 
problem are you haveing difficulty with - creating the images? 
(maybe dynamically?) or displaying a different image to the user?

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list