GetPictures Applet Introduction |
Try it at http://www.jeremyparsons.com/personal/picture_viewer_applet.html
The latest Java plug-in and JRE for your browser can be downloaded from sun and then installed according to the downloaded instructions. The web has millions of amazing Java applets so it is generally worth considering this download, but especially if your browser initially came without Java, or your Java Runtime Environment (JRE) has been superseded, or become noticeably buggy.For more information on configuring your web server to allow directory indexes, see either apache documentation, or that from whichever webserver you use.
Many digital cameras produce raw JPEG image files over 3MB by default - downloading a directory of such images would take hours over a slow connection and would consequently irritate and lose most of your audience. Most existing image editing programs like The Gimp offer interactive dialogues that enable you to choose the most appropriate compromise between file size and image quality. However, editing all your photographs by hand just to produce a copied set of lower file size is a waste of effort when other program scan automate this task for you. Apple Mac owners can use iPhoto which is free with Mac OS X, and everyone can use the Java application JPEGDirCopy from Jeremy Parsons. A good compromise between file size, quality, and the expected available screen space of a typical Web surfer would be to use an image size of 800 by 800 pixels and a JPEG quality level of 0.7 to give a typical file size of 70 KB though highly detailed photographs of forests, complex textures etc. would be around 100KB and sunsets or big blue skies around 30KB.
Oracle bought Sun and Java has grown so now there are a few versions of Java around and, unfortunately, the newest version of open java no longer support the deprecated com.sun classes including a fast JPEG image processing class which is used in getpictures so try older versions of open Java or Oracle's own JDK if you get problems.
An introduction to applets and a course teaching the important parts of the Java Abstract Windowing Toolkit AWT can be found at the Sun Microsystems Java website.
To fit within Java's tight applet security sandbox, it is necessary to
store all the JPEG images, and all the Java code on the same webserver as
the HTML page containing the applet tag. For most people this is not a problem
as they only use one webserver for all their web pages but it does preclude
using this applet for viewing images really published by someone else on
some other website. Furthermore, you cannot use one copy of GetPictures.jar
from multiple web image servers, each must have its own copy.
The most important attribute of the applet tag is the archive attribute
which specifies the location of the Applet Java Bytecode stored and compressed
into the GetPictures.jar
<applet archive="http://www.blah.net/myclasses/GetPictures.jar" ...
The location of your online top-level folder of photograph folders is
specified via the applet parameter "PictureDirectoryURL" as shown below:
<param name="PictureDirectoryURL" value="http://www.blah.net/personal/picture_pages">
Most URL's would typically be relative "../classes/GetPictures.jar" or "./picture_pages" to allow a website to be moved around easily
The Java jars are ready for use immediately, but more testing and customisation would be useful.
The JPEG images are uploaded by the website administrator (usually by
ftp) to a standard Web server as folders of *.jpg files. All the complicated
download work of screen scraping, multithreaded image downloads, thumbnail
preparation, picture indexes and iterative slide shows is done in the existing
Java 1.1 standard client code.
# With a web browser or appletviewer for a full external example:
http://www.jeremyparsons.com/personal/picture_viewer_applet.html
# These commands can be used to run the applet outside a browser
java -jar GetPictures.jar http://www.jeremyparsons.com/personal/picture_pages java -cp GetPictures.jar com.jeremyparsons.imaging.GetPictures http://www.jeremyparsons.com/personal/picture_pages appletviewer http://localhost/~jparsons/jparsons/personal/picture_viewer_applet.html java -cp $PWD com.jeremyparsons.imaging.GetPictures http://localhost.localdomain/~jparsons/jeremyparsons.com/personal/picture_pages java -cp $PWD com.jeremyparsons.imaging.GetPictures http://www.chucktankoracing.com/images/viewer
# Internally with more memory and using my own apache web server configured
to allow directory listings:
java -Xmx100M -cp $PWD com.jeremyparsons.imaging.GetPictures http://localhost/~jparsons/jparsons/personal/picture_pages jdb -classpath $PWD ... appletviewer -debug ...
# or if running over X with > Java2 version 1.3, disable offscreen buffering
java -Dsun.java2d.pmoffscreen=false ...
Just type "make", or the jar files can be created with the following commands
but see the Makefile or Ant for something better.
javac -O -d . *.java jar cvf GetPictures.jar embl README jar cvf GetPicturesSource.jar *.java *.html README docs Makefile chmod a+r *.jar