> pictools > doc > showingPictures
> pictools > doc > showingPictures
Pictools: How Things Work
V3.3 (445)
Showing Pictures
How a picture gets to the user's screen
hibiscus
Sample picture page

Pictools has the goal of providing access to hundreds of pictures. To be tidy, pictures are stored in a separate tree rooted at /pictures. Users can access them directly from that tree; for the image at right, the picture is at http://physpics.com/pictures/2014/01-Hawaii/DSC03464.JPG. Viewed as an image, the picture lacks all niceties like navigation buttons. The link for the nicer page, the one shown to the right, is http://physpics.com/annals/2014/Hawaii/DSC03464.php. Links to this page are in a thumbs page and the NEXT and PREV buttons of adjacent images. All three links are like this:

<a href="DSC03464.php">

 

Making links from thumbnails to picture pages

file: Spring Spring Flowers in Philadelphia and Pittsburgh
picturesdir: /pictures/2014/03-March
subtitle: <a href="http://theflowershow.com/">Philadelphia Flower Show</a>
Susan timed her talk at Rutgers to afford a visit to the flower show.
[IMG_20140303_162309.jpg] 
[IMG_20140303_125312.jpg]
Fragment of /annals/2014/captions.cap

When a source directory contains a captions file, say allcaps.cap, gendirs is invoked on the source computer to create one subdirectory for each "file:" segment in that file. The subdirectory will contain a thumbs page called index.php and .cap file called localcaptions.cap. The latter being a copy of the segment's lines from allcaps.cap. To generate the thumbs file, gendirs  expands thumbsparms.php and when it reaches "$pictures" it processes the lines of localcaptions.cap. For each [picturename.ext] it expands an instance of pictd.html, And there it is, in the middle of pictd.html, the link line. The destination of the link is set to picturename.php.

When a thumb link is clicked

Pictures are displayed in a picture frame by servepicture. The most common way to get from a click on a thumbnail to servepicture is via /.htaccess, an Apache server configuration file. Its next-to-last rule says approximately:

If a request is for a non-existent file name.ext
   in a directory dir that has a localcaptions.cap file,
then change the request to
  /library/servepicture.php?cap=/dir/localcaptions.cap&image=name.ext

Note that the dir value applies also to the image.

See the documentation for servepicture to see how it handles this request by parsing localcaptions.cap, setting frameparm.xxx properties, and including frame.php, which uses those properties. The location of the actual picture is taken from the picturesdir line in the localcaptionscap.

If there is no localcaptions.cap, the request is passed to urlHandler. The request could still be for a picture, because the directory may have been created by older code that did not create a localcaptions.cap file. In that case, there may be an appropriate .cap file in an ancestor directory. To check for this case, urlHandler calls pkscripts.findCoveringCapFile looking for a captions file that mentions the requested picture. If so, servepicture is called appropriately and include frame.php as above.

Making the NEXT/PREV links

The NEXT and PREV links for a picture appear in the upper-right of a picture frame page. When a thumbs page picture link is clicked, the destination page does not exist, let alone its links. The link data is collected as servepicture has the captions file scanned. The pages for NEXT and PREV are stored in properties frameparm.next and frameparm.prev. Frame.php sets property page.toprow to frame.toprow, which which means there is only one top row, frametitle.php. It is this latter file that sets the links to the values in the frameparm properties.

 
Copyright © 2023 ZweiBieren, All rights reserved. Feb 5, 2023 17:05 GMT Page maintained by ZweiBieren