%!PS % ACROBAT "GALLEY SLAVE" AUTOMATIC GALLERY GENERATOR V1.5 % ======================================================== % Copyright c 2001 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.5 % The usual HTML "gallery" grouping of thumbnail pictures has several severe % flaws. Besides being hard to create, dozens to hundreds of klutzy ISP generated % file swaps may be required. These PostScript utilities emulate a HTML % gallery in an (often) single and (often) compact PDF file. They retain most % gallery features, while permitting a simple and convenient data base style entry. % They also offer clicking to ~separate~ description/purchase and image % magnification url's. Plus optional multi-page or mult-screen galleries. % Speed depends on the number of thumbnails, size, comm time, and user processor. % It is often not significantly slower than multi-file HTML. And sometimes faster. % Very large galleries are best split into modular "rooms" or page-by-page delivered. % File sizes above 100K will download slower. A limit of 24 or fewer thumbnails per % PDF file is recommended. As is avoiding any vertical or horizontal page scrolling. % Known bugs: May return to the first, rather than the selected PDF page in IE if % IE is not the default browser. Workaround is to deliver only one gallery page % at a time. There is a possible blowup problem with Netscape if you .PDF link to a % .JPEG file rather than a .HTML one. Workaround is to use HTML containers with % IMAGE commands. % 100% size and Window Resize should be manually forced before uploading by using % file ---> document info ---> open in Acrobat. Otherwise thumbnails may distort. % Although this code allows fully automatic generation of multiple pages of % thumbnails, it is probably better to deliver them on a page-by-page basis. % Thus easing the known bugs and fractioning the load times. % To use, read and edit this file in a suitable ASCII editor or word processor. % Then distill the new file using Adobe Acrobat or GhostScript. % IMPORTANT NOTE: Don Lancaster's file gonzo.ps is required to run this program. % Get it at http://www.tinaja.com/post01.asp % After obvious location mods, uncomment ONE of the following two lines: (C:\\windows\\desktop\\gonzo\\gonzo.ps) run % use internal gonzo % (A:\\gonzo.ps) run % use external gonzo % NOTE THAT ALL PS FILENAME STRINGS !!!DEMAND!!! DOUBLE REVERSE SLASHES. % GONZO20A Guru Gonzo PostScript power tools (Interim release) % Includes gonzo justification and layout utilities. % Copyright c 1990,1996,2001 by Don Lancaster and Synergetics, Box 809, % Thatcher Arizona, 5552 (928) 428-4073 don@tinaja.com support % via http://www.tinaja.com All commercial rights and all electronic % media rights **FULLY** reserved. Reposting is expressly forbidden. %%%%%%%%%%%%%%%%%%% CREATING GALLERY DATA %%%%%%%%%%%%%%%%%%%%%%%%% % Gallery data may be created internally or may be run from an external data file. % The internal method will be shown as active here. Uncommment run to overwrite. % The /galdata gallery data consists of an array of arrays. There is one array for % each thumbnail to be generated. The array sequence is right by columns and down % by rows for the needed number of pages. Pages may be full or partial. % Each galdata thumbnail entry consists of six values. A string for the thumbnail % .JPG filename source using double reverse slashes where needed. A string for the % url to go to when the thumbnail text is clicked on mouseover. A sting for the url % to go to when the thumbnail image is clicked on mouseover. A string for the % thumbnail description and ALT substitute.An image pixel width count integer. An % image pixel height count integer. An optional comment thumb number can also % be included, as can a commented title. % On the thumbnail descriptions, use TWO textlines or prefix string with "\n|h". % Note that "\n" in a PS string forces a newline. "|h" is a gonzo halfline up. % Like so... /thumbsourceprefix (C:\\WINDOWS\\Desktop\\aaNenewsand\\bargains\\thumb\\) def /thumbtextdestprefix (http://www.tinaja.com/bargains/) def /thumbimagedestprefix (http://www.tinaja.com/images/bargs/) def /galdata [ % must, of course, be modified for your files in your locations... [ %0 (artilz1.jpg) (sbmilit.asp) (artil01.jpg) (military scale\ntime-distance-range) 125 20 ] [ %1 (cat5yz1.jpg) (sbwire.asp) (cat5y01.jpg) (cat5 plenum\nnetworking cable) 125 76 ] [ %2 (ciscoz1.jpg) (sbwire.asp) (cisco01.jpg) (cisco V.35MT\nDTE cable) 86 125 ] [ %3 (dishmoz1.jpg) (sbmotors.asp) (dishm01.jpg) (whirlpool dishwasher\nmotor and pump) 101 125 ] [ %4 (eddysz1.jpg) (sbndt.asp) (eddys01.jpg) (VM102A ndt eddy\ncurrent surface probe) 125 121 ] [ %5 (eddyz2.jpg) (sbndt.asp) (eddy02.jpg) (0.316 inch ndt\neddy current probe) 59 125 ] [ %6 (egrz2.jpg) (sbpress.asp) (egr02.jpg) (3-way low pressure\nair-vac valve) 111 125 ] [ %7 (fanlitz1.jpg) (sblamps.asp) (fanlit01.jpg) (triple ceiling\nfan light kit) 124 79 ] [ %8 (gouldz1.jpg) (sbclasstg.asp) (gould01.jpg) (gould 8-channel\nanalog data recorder) 125 112 ] [ %9 (eddyz3.jpg) (sbndt.asp) (eddy03.jpg) (23/64 inch ndt\neddy current probe) 125 57 ] ] def % To use an external gallery data file, change then uncomment this line... % (C:\\full\\filename.of\\your.gallery\\data.txt)run %%%%%%%%%%%%%%%%%%% SETTING LAYOUT VARIABLES %%%%%%%%%%%%%%%%%%%%%%% % These variables change the layout size and appearance... /thumbsperrow 4 def % thumbnails per row /thumbrows 2 def % thumbnails rows per page /thumbsperpage thumbsperrow thumbrows mul def % thumbnails per page /thumbboxwidth 130 def % thumb box width in points /thumbimageheight 130 def % live thumb box height in points /thumbtitleheight 25 def % thumb box title height in points /totalthumbheight thumbimageheight % total thumb box height in points thumbtitleheight add def /thumbrad 8 def % radius of thumb boxes /thumbhpadding 10 def % horizontal space between thumb boxes /thumbvpadding 10 def % vertical space between thumb boxes /font0 /StoneSans-Bold 22 gonzofont % page titling font /font1 /StoneSans-Bold 8.5 gonzofont % thumb box titling (ALT) font /font2 /StoneSans-Bold 14 gonzofont % page detail font /thumbtitposn 14 def % position of top thumb text baseline /thumbtityinc 9 def % thumb title line increment /thumbimagebkgcolor {0.8 0.8 0.8} def % image box background color as rgb /thumbimagetitbkgcolor {0.9 0.9 0.9} def % image box title background color as rgb /thumbimagetitcolor {0 0.3 0.7} def % image title lettering color as rgb /pagebkgcolor {0.4 0.8 0.8} def % page background color as rgb /maintextcolor {0.25 0.25 0} def % page text color as rgb /upperlefthposn 31 def % upper left h posn of first thumb box /upperleftvposn 723 def % upper left v posn of first thumb box /galleycropbox [0 391 612 780] def % galley pagesizes llx lly urx ury /hcen galleycropbox 2 get 2 div def % title hcenter /titlebase 750 def % title base /textbase 731 def % text base %%%%%%%%%%%%%%%%%% GALLERY GENERATOR UTILITY PROCS %%%%%%%%%%% % /setupgalley does a printer lockout and sets the page sizes... /startgalley { /pdfmark where {pop} {userdict % printer lockout - should NOT happen /pdfmark /cleartomark load put} ifelse [/CropBox galleycropbox /PAGES pdfmark % change page size for single screen } def % /startnewthumbpage establishes the page background color. % Later it might add wallpaper and a title... /startnewthumbpage { -10 -10 mt 1000 pu % set page background color 1000 pr 1000 pd closepath pagebkgcolor setrgbcolor fill black maintextcolor setrgbcolor % title color font0 hcen titlebase (Guru's Lair Bargain Gallery Tour) cc % title font1 hcen textbase (click on IMAGE to magnify \267 click on TEXT for price & info \267 use NAV ARROWS for more bargains) cc } def % /thumbpagecheck determines if the current page has been filled. If so, the page is completed, % and a new page is begun... /thumbpagecheck { currentthumb 0 ne % are we past the first thumb? currentthumb thumbsperpage mod % are we the first thumb on a new page? 0 eq and % together? {finishpage} if % complete page } def % /finishpage later may add arrow navigation... /finishpage { showpage % show completed page startnewthumbpage % start next page } def /finishlastpage {showpage} def % /positionbox calculates needed positioning values and translates to the current thumbox. % NOTE: A later graphics state restore is needed when boxwork is complete... /positionbox { currentthumb thumbsperpage mod % where are we on the page? /currentpagethumb exch store % save onpage value currentpagethumb thumbsperrow idiv % calculate row /currentrow exch store currentpagethumb thumbsperrow mod % calculate column /currentcol exch store /txpos upperlefthposn % calculate box ll xposition thumbboxwidth thumbhpadding add currentcol mul add store /typos upperleftvposn % calculate box ll yposition totalthumbheight thumbvpadding add currentrow mul sub totalthumbheight sub store save /thumbsnap exch store % save position and condition txpos typos translate % translate to thumbbox ll corner } def % makebox draws a rounded box with a title bar... /makebox { 0 0 % draw rounded box with gonzo utils thumbboxwidth totalthumbheight thumbrad roundbox clip % keep everybody inbounds thumbimagebkgcolor setrgbcolor fill % and fill black 0 thumbimageheight mt % paint title background 0 totalthumbheight lineto thumbboxwidth pr totalthumbheight thumbimageheight sub pd closepath thumbimagetitbkgcolor setrgbcolor fill % and fill black } def % letterbox applies the box thumb ALT lettering... % presently assumes each title is two lines high. Use (\n|hstuff) if not /letterbox { font1 % pick box title font thumbboxwidth 2 div % center title thumbimageheight thumbtitposn add % set baseline thumbimagetitcolor setrgbcolor % set color /yinc thumbtityinc store % set line spacing galdata currentthumb get 3 get % get message cc % and show } def % /maketexturllink and /makeimageurllink use pdfmark operators to provide mouseover % linking. These should get done before the image is shown to simplify centering. % See Adobe TN5150, the pdfmark reference manual. /maketexturllink { /curtexturlname thumbtextdestprefix % get prefix galdata currentthumb get 1 get % get url from galdata list mergestr store % combine and save mark /Rect [0 thumbimageheight thumbboxwidth % llx lly urx ury totalthumbheight] % use title area only /Border [0 0 0] % no color /Color [0.7 0 0 ] % not used /Action <> % link url from input dat /Subtype /Link % desired pdfmark action /ANN % annotation type pdfmark % call pdf operators } def /makeimageurllink { /curimageurlname thumbimagedestprefix % get prefix galdata currentthumb get 2 get % get url from galdata list mergestr store % combine and save mark /Rect [0 0 thumbboxwidth thumbimageheight 5 sub ] % use image height /Border [0 0 0] % no color /Color [0.7 0 0 ] % not used /Action <> % link url from input dat /Subtype /Link % desired pdfmark action /ANN % annotation type pdfmark % call pdf operators } def % /calcimageposn centers the image in the thumbbox. If the image is too big, it will % be centered but clipped to the border. /calcimageposn { thumbboxwidth % get box width galdata currentthumb get 4 get % get image width dup /curimagewidth exch store % save for image operator sub 2 div % half the distance thumbimageheight % get box height galdata currentthumb get 5 get % get image height dup /curimageheight exch store % save for image operator sub 2 div % half the distance % translate % position image } def % /placeimage converts the .JPG file for the PS image operator and suitably scales % and positions the image.. /placeimage { gsave /DeviceRGB setcolorspace % pick color model curimagewidth curimageheight scale % magnify unit square /imfilename thumbsourceprefix % get full image filename galdata currentthumb get 0 get mergestr store /imfile imfilename (r) file store % establish input read file /Data {imfile /DCTDecode filter} store % define a data source << % start image dicationary /ImageType 1 % always one /Width curimagewidth % JPEG width in pixels /Height curimageheight % JPEG height in pixels /ImageMatrix [ curimagewidth % scale and position 0 0 curimageheight neg 0 curimageheight ] /DataSource Data % proc to get filtered JPEG /BitsPerComponent 8 % color resolution /Decode [0 1 0 1 0 1] % per red book 4.10 >> image % call the image operator grestore } def %%%%%%%%%%%%%%%%%%%% GALLERY GENERATOR MAIN CODE %%%%%%%%%%%%%%%%% % This is the main controlling code that calls the above utility procs when % and as required... /makegallery { startgalley % do initial housekeeping startnewthumbpage % set page background 0 1 galdata length 1 sub {/currentthumb exch store % loop for each thumb value set thumbpagecheck % check for completed page positionbox % locate next thumb on page makebox % create thumb box letterbox % letter thumb box maketexturllink % generate text mouseover url makeimageurllink % generate image mouseover url calcimageposn % center image placeimage % read and place image thumbsnap restore % get back on full page (undoes positionbox save) } for finishlastpage % show final (possibly incomplete) page } def %%%%%%%%%%%%%%%%%%%%% GALLERY GENERATOR ACTIVATION %%%%%%%%%%%%%%%%% % This command creates the actual gallery pages makegallery % build intermediate gallery pages