* See also these automated build alternatives added in 2.1: * ./_generate.sh * ../../build/generate-examples.py Manual generation: Short story - build two galleries here with: ~/MY-STUFF/Code/thumbspage/examples$ py3 ../thumbspage.py reorientation Clean thumbs folder [y or n] (enter=y)? Thumbs per row [int] (enter=4)? Thumb max size [x, y] (enter=(100, 100))? Use image-viewer pages [y or n] (enter=y)? ~/MY-STUFF/Code/thumbspage/examples$ py3 ../thumbspage.py reorientation/Unrotated-images-in-browsers Clean thumbs folder [y or n] (enter=y)? Thumbs per row [int] (enter=4)? 3 Thumb max size [x, y] (enter=(100, 100))? 150, 150 Use image-viewer pages [y or n] (enter=y)? Details - the verification examples below were run on Mac OS (HFS+); Windows, Linux, Android, and other Macs work well too. See also ../_README.txt for more on this folder's content. The diffall.py script used in the verifications below is available at learning-python.com/mergeall.html, and the "py3" is just an alias for "python3" on the system used. Notice that this gallery sets page background in its header's CSS, instead of setting the thumbs-table background in user_configs.py; see .com/site-mobile-screenshots for an example of the latter. SUBTLE BIT: this page's HEADER.html uses an absolute-path live link to a script at learning-python.com to display itself as raw code, because a simple relative filename reference in '.' renders the HTML offline, and won't work at all online; a '../../../cgi' reference to the display script fails offline; and one must choose wisely... ---- UPDATE August 2021 [2.1] - Restored and rethumbspaged Despite what the next update says, the ".original" files were and are the true originals - before shrinkpix, rotation, any exif tag loss, or embedded thumbnail removal. Most also displayed skewed thumbnails in 1/3 of the file explorers tested prior to 2.1. To fix, restored originals with the following, and simply ran thumbspage just once to rotate and drop embedded thumbnails, via the new _generate.sh script. Shrinkpix was _not_ run again, because the largest rotated image was 1.6M, and only three were over 1M; this is reasonable for online use, and the goal here is to demo thumbspage, not shrinkpix. In the future, simply run _generate.sh for thumbspage changes. ~$ cd /Users/me/MY-STUFF/Code/thumbspage/examples/reorientation ~/MY-STUFF/Code/thumbspage/examples/reorientation$ py3 $C/thumbspage/docetc/restore-originals.py Moved sonydsc-6R.JPG.original to sonydsc-6R.JPG Moved ipod6g-8L.JPG.original to ipod6g-8L.JPG Moved galaxys8-8L.jpg.original to galaxys8-8L.jpg Moved sonydsc-8L.JPG.original to sonydsc-8L.JPG Moved ipod6g-6R.JPG.original to ipod6g-6R.JPG Moved galaxys8-6R.jpg.original to galaxys8-6R.jpg Moved ipod6g-3U.JPG.original to ipod6g-3U.JPG Moved galaxys8-3U.jpg.original to galaxys8-3U.jpg Moved sonydsc-3U.JPG.original to sonydsc-3U.JPG ~/MY-STUFF/Code/thumbspage/examples/reorientation$ bash _generate.sh Clean thumbs folder [y or n] (enter=y)? Thumbs per row [int] (enter=4)? Thumb max size [x, y] (enter=(100, 100))? Use image-viewer pages [y or n] (enter=y)? Running Cleaning: ./_thumbspage/untagged2-scan.jpg.html Cleaning: ./_thumbspage/ipod6g-6R.JPG.html Cleaning: ./_thumbspage/galaxys8-3U.jpg Cleaning: ./_thumbspage/galaxys8-1N.jpg.html Cleaning: ./_thumbspage/galaxys8-8L.jpg.html Cleaning: ./_thumbspage/ipod6g-8L.JPG Cleaning: ./_thumbspage/galaxys8-1N.jpg Cleaning: ./_thumbspage/untagged4-png.png Cleaning: ./_thumbspage/sonydsc-6R.JPG.html Cleaning: ./_thumbspage/ipod6g-6R.JPG Cleaning: ./_thumbspage/sonydsc-6R.JPG Cleaning: ./_thumbspage/untagged4-png.png.html Cleaning: ./_thumbspage/untagged3-gif.gif.html Cleaning: ./_thumbspage/untagged1-jpg.jpg.html Cleaning: ./_thumbspage/sonydsc-8L.JPG Cleaning: ./_thumbspage/galaxys8-3U.jpg.html Cleaning: ./_thumbspage/galaxys8-8L.jpg Cleaning: ./_thumbspage/ipod6g-1N.JPG Cleaning: ./_thumbspage/ipod6g-3U.JPG.html Cleaning: ./_thumbspage/galaxys8-6R.jpg Cleaning: ./_thumbspage/untagged2-scan.jpg Cleaning: ./_thumbspage/untagged3-gif.gif Cleaning: ./_thumbspage/sonydsc-3U.JPG.html Cleaning: ./_thumbspage/ipod6g-3U.JPG Cleaning: ./_thumbspage/sonydsc-3U.JPG Cleaning: ./_thumbspage/sonydsc-1N.JPG.html Cleaning: ./_thumbspage/sonydsc-8L.JPG.html Cleaning: ./_thumbspage/ipod6g-1N.JPG.html Cleaning: ./_thumbspage/ipod6g-8L.JPG.html Cleaning: ./_thumbspage/untagged1-jpg.jpg Cleaning: ./_thumbspage/sonydsc-1N.JPG Cleaning: ./_thumbspage/galaxys8-6R.jpg.html Making thumbnail: ./_thumbspage/galaxys8-3U.jpg --Reorienting tilted image --Note: embedded thumbnail was deleted Skipping: index.html Skipping: .DS_Store Making thumbnail: ./_thumbspage/ipod6g-8L.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Making thumbnail: ./_thumbspage/galaxys8-1N.jpg Making thumbnail: ./_thumbspage/untagged4-png.png Making thumbnail: ./_thumbspage/ipod6g-6R.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Making thumbnail: ./_thumbspage/sonydsc-6R.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Skipping: restore-originals.py Making thumbnail: ./_thumbspage/sonydsc-8L.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Skipping: _thumbspage Making thumbnail: ./_thumbspage/galaxys8-8L.jpg --Reorienting tilted image --Note: embedded thumbnail was deleted Making thumbnail: ./_thumbspage/ipod6g-1N.JPG Skipping: _generate.sh Making thumbnail: ./_thumbspage/galaxys8-6R.jpg --Reorienting tilted image --Note: embedded thumbnail was deleted Making thumbnail: ./_thumbspage/untagged2-scan.jpg Skipping: _true-rotate-originals Making thumbnail: ./_thumbspage/untagged3-gif.gif Making thumbnail: ./_thumbspage/ipod6g-3U.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Making thumbnail: ./_thumbspage/sonydsc-3U.JPG --Reorienting tilted image --Note: embedded thumbnail was deleted Skipping: Unrotated-images-in-browsers Skipping: HEADER.html Making thumbnail: ./_thumbspage/untagged1-jpg.jpg Making thumbnail: ./_thumbspage/sonydsc-1N.JPG Skipping: _HOW-MADE.txt Generating thumbnails index page Generating view page for: galaxys8-1N.jpg Generating view page for: galaxys8-3U.jpg Generating view page for: galaxys8-6R.jpg Generating view page for: galaxys8-8L.jpg Generating view page for: ipod6g-1N.JPG Generating view page for: ipod6g-3U.JPG Generating view page for: ipod6g-6R.JPG Generating view page for: ipod6g-8L.JPG Generating view page for: sonydsc-1N.JPG Generating view page for: sonydsc-3U.JPG Generating view page for: sonydsc-6R.JPG Generating view page for: sonydsc-8L.JPG Generating view page for: untagged1-jpg.jpg Generating view page for: untagged2-scan.jpg Generating view page for: untagged3-gif.gif Generating view page for: untagged4-png.png Finished: see the results in the images folder, ".". ...plus more for building the nested Unrotated* gallery... ---- UPDATE March 2020: Using shrinkpix on folders with rotated images For all rotated images here, the existing gallery versions did not have the 1.7 fix for Exif-tag propagation and updates. Applying this fix required a 4-step process: unrotated originals (with full tags) were restored with the restore*.py here; thumbspage was run to rotate the originals (and propagate their tags); the shrinkpix program was used to reduce the sizes of rotated originals; and then thumbspage was run again to pick up the new shrunken image information. The shrinkpix saved (and already rotated) originals here were propagated to _private, so future restores won't undo rotations and tags. Convoluted, yes, but date-taken now shows up for rotated images as it should, and most of this isn't required for new galleries (these were legacy rotated images). New galleries can either: 1) Rotate originals with thumbspage, shrink, and re-thumbspage for new info 2) Shrink originals, and then run thumbspage to rotate and pick up info The latter, shrinking before rotating, avoids a step, but some rotations wound up slightly above the shrinkpix size cutoff when this was tried, and you'll need to rerotate with another thumbspage run if saved originals are ever restored from shrinkpix backups (a rerun is probably needed anyhow). ---- ORIGINAL: How to build and verify the top rotated-image gallery: -------------------------------------------------------------------------------- 1) GENERATE thumbnails, rotate tilted images, save backups (first run) -------------------------------------------------------------------------------- # This step has already been run in the examples folder shipped. # Other viewers may auto-rotate too - rename and check the tags. ~/MY-STUFF/Code/thumbspage/examples$ py3 ../thumbspage.py reorientation Clean thumbs folder [y or n] (enter=y)? Thumbs per row [int] (enter=4)? Thumb max size [x, y] (enter=(100, 100))? Use image-viewer pages [y or n] (enter=y)? Running Skipping: .DS_Store Skipping: _HOW-MADE.txt Skipping: _thumbspage Making thumbnail: reorientation/_thumbspage/galaxys8-1N.jpg Making thumbnail: reorientation/_thumbspage/galaxys8-3U.jpg --Reorienting tilted image Making thumbnail: reorientation/_thumbspage/galaxys8-6R.jpg --Reorienting tilted image Making thumbnail: reorientation/_thumbspage/galaxys8-8L.jpg --Reorienting tilted image Skipping: HEADER.html Making thumbnail: reorientation/_thumbspage/ipod6g-1N.JPG Making thumbnail: reorientation/_thumbspage/ipod6g-3U.JPG --Reorienting tilted image Making thumbnail: reorientation/_thumbspage/ipod6g-6R.JPG --Reorienting tilted image Making thumbnail: reorientation/_thumbspage/ipod6g-8L.JPG --Reorienting tilted image Skipping: restore-originals.py Making thumbnail: reorientation/_thumbspage/sonydsc-1N.JPG Making thumbnail: reorientation/_thumbspage/sonydsc-3U.JPG --Reorienting tilted image Making thumbnail: reorientation/_thumbspage/sonydsc-6R.JPG --Reorienting tilted image Making thumbnail: reorientation/_thumbspage/sonydsc-8L.JPG --Reorienting tilted image Making thumbnail: reorientation/_thumbspage/untagged1-jpg.jpg Making thumbnail: reorientation/_thumbspage/untagged2-scan.jpg Making thumbnail: reorientation/_thumbspage/untagged3-gif.gif Making thumbnail: reorientation/_thumbspage/untagged4-png.png Generating thumbnails index page Generating view page for: galaxys8-1N.jpg Generating view page for: galaxys8-3U.jpg Generating view page for: galaxys8-6R.jpg Generating view page for: galaxys8-8L.jpg Generating view page for: ipod6g-1N.JPG Generating view page for: ipod6g-3U.JPG Generating view page for: ipod6g-6R.JPG Generating view page for: ipod6g-8L.JPG Generating view page for: sonydsc-1N.JPG Generating view page for: sonydsc-3U.JPG Generating view page for: sonydsc-6R.JPG Generating view page for: sonydsc-8L.JPG Generating view page for: untagged1-jpg.jpg Generating view page for: untagged2-scan.jpg Generating view page for: untagged3-gif.gif Generating view page for: untagged4-png.png Finished: see the results in the images folder, "reorientation". -------------------------------------------------------------------------------- 2) VERIFY no rotation required in subsequent runs, prior backups skipped -------------------------------------------------------------------------------- ~/MY-STUFF/Code/thumbspage/examples$ py3 ../thumbspage.py reorientation Clean thumbs folder [y or n] (enter=y)? Thumbs per row [int] (enter=4)? Thumb max size [x, y] (enter=(100, 100))? Use image-viewer pages [y or n] (enter=y)? Running Cleaning: reorientation/_thumbspage/galaxys8-1N.jpg Cleaning: reorientation/_thumbspage/galaxys8-1N.jpg.html Cleaning: reorientation/_thumbspage/galaxys8-3U.jpg Cleaning: reorientation/_thumbspage/galaxys8-3U.jpg.html Cleaning: reorientation/_thumbspage/galaxys8-6R.jpg Cleaning: reorientation/_thumbspage/galaxys8-6R.jpg.html Cleaning: reorientation/_thumbspage/galaxys8-8L.jpg Cleaning: reorientation/_thumbspage/galaxys8-8L.jpg.html Cleaning: reorientation/_thumbspage/ipod6g-1N.JPG Cleaning: reorientation/_thumbspage/ipod6g-1N.JPG.html Cleaning: reorientation/_thumbspage/ipod6g-3U.JPG Cleaning: reorientation/_thumbspage/ipod6g-3U.JPG.html Cleaning: reorientation/_thumbspage/ipod6g-6R.JPG Cleaning: reorientation/_thumbspage/ipod6g-6R.JPG.html Cleaning: reorientation/_thumbspage/ipod6g-8L.JPG Cleaning: reorientation/_thumbspage/ipod6g-8L.JPG.html Cleaning: reorientation/_thumbspage/sonydsc-1N.JPG Cleaning: reorientation/_thumbspage/sonydsc-1N.JPG.html Cleaning: reorientation/_thumbspage/sonydsc-3U.JPG Cleaning: reorientation/_thumbspage/sonydsc-3U.JPG.html Cleaning: reorientation/_thumbspage/sonydsc-6R.JPG Cleaning: reorientation/_thumbspage/sonydsc-6R.JPG.html Cleaning: reorientation/_thumbspage/sonydsc-8L.JPG Cleaning: reorientation/_thumbspage/sonydsc-8L.JPG.html Cleaning: reorientation/_thumbspage/untagged1-jpg.jpg Cleaning: reorientation/_thumbspage/untagged1-jpg.jpg.html Cleaning: reorientation/_thumbspage/untagged2-scan.jpg Cleaning: reorientation/_thumbspage/untagged2-scan.jpg.html Cleaning: reorientation/_thumbspage/untagged3-gif.gif Cleaning: reorientation/_thumbspage/untagged3-gif.gif.html Cleaning: reorientation/_thumbspage/untagged4-png.png Cleaning: reorientation/_thumbspage/untagged4-png.png.html Skipping: .DS_Store Skipping: _HOW-MADE.txt Skipping: _thumbspage Making thumbnail: reorientation/_thumbspage/galaxys8-1N.jpg Making thumbnail: reorientation/_thumbspage/galaxys8-3U.jpg Skipping: galaxys8-3U.jpg.original Making thumbnail: reorientation/_thumbspage/galaxys8-6R.jpg Skipping: galaxys8-6R.jpg.original Making thumbnail: reorientation/_thumbspage/galaxys8-8L.jpg Skipping: galaxys8-8L.jpg.original Skipping: HEADER.html Skipping: index.html Making thumbnail: reorientation/_thumbspage/ipod6g-1N.JPG Making thumbnail: reorientation/_thumbspage/ipod6g-3U.JPG Skipping: ipod6g-3U.JPG.original Making thumbnail: reorientation/_thumbspage/ipod6g-6R.JPG Skipping: ipod6g-6R.JPG.original Making thumbnail: reorientation/_thumbspage/ipod6g-8L.JPG Skipping: ipod6g-8L.JPG.original Skipping: restore-originals.py Making thumbnail: reorientation/_thumbspage/sonydsc-1N.JPG Making thumbnail: reorientation/_thumbspage/sonydsc-3U.JPG Skipping: sonydsc-3U.JPG.original Making thumbnail: reorientation/_thumbspage/sonydsc-6R.JPG Skipping: sonydsc-6R.JPG.original Making thumbnail: reorientation/_thumbspage/sonydsc-8L.JPG Skipping: sonydsc-8L.JPG.original Making thumbnail: reorientation/_thumbspage/untagged1-jpg.jpg Making thumbnail: reorientation/_thumbspage/untagged2-scan.jpg Making thumbnail: reorientation/_thumbspage/untagged3-gif.gif Making thumbnail: reorientation/_thumbspage/untagged4-png.png Generating thumbnails index page Generating view page for: galaxys8-1N.jpg Generating view page for: galaxys8-3U.jpg Generating view page for: galaxys8-6R.jpg Generating view page for: galaxys8-8L.jpg Generating view page for: ipod6g-1N.JPG Generating view page for: ipod6g-3U.JPG Generating view page for: ipod6g-6R.JPG Generating view page for: ipod6g-8L.JPG Generating view page for: sonydsc-1N.JPG Generating view page for: sonydsc-3U.JPG Generating view page for: sonydsc-6R.JPG Generating view page for: sonydsc-8L.JPG Generating view page for: untagged1-jpg.jpg Generating view page for: untagged2-scan.jpg Generating view page for: untagged3-gif.gif Generating view page for: untagged4-png.png Finished: see the results in the images folder, "reorientation". --------------------------------------------------------------------------- 3) RESTORE tilted-image originals from backups (if and when needed) -------------------------------------------------------------------------------- ~/MY-STUFF/Code/thumbspage/examples$ cd reorientation/ ~/MY-STUFF/Code/thumbspage/examples/reorientation$ py3 ~/MY-STUFF/Code/thumbspage/docetc/restore-prerotate-originals.py Moved galaxys8-3U.jpg.original to galaxys8-3U.jpg Moved galaxys8-6R.jpg.original to galaxys8-6R.jpg Moved galaxys8-8L.jpg.original to galaxys8-8L.jpg Moved ipod6g-3U.JPG.original to ipod6g-3U.JPG Moved ipod6g-6R.JPG.original to ipod6g-6R.JPG Moved ipod6g-8L.JPG.original to ipod6g-8L.JPG Moved sonydsc-3U.JPG.original to sonydsc-3U.JPG Moved sonydsc-6R.JPG.original to sonydsc-6R.JPG Moved sonydsc-8L.JPG.original to sonydsc-8L.JPG -------------------------------------------------------------------------------- 4) PROVE that restores work (diffall to saved copy) -------------------------------------------------------------------------------- ~/MY-STUFF/Code/thumbspage/examples/reorientation$ cd .. ~/MY-STUFF/Code/thumbspage/examples$ py3 /MY-STUFF/Code/mergeall/diffall.py reorientation ../_private/reorientation-FINAL-SAVE/ -skipcruft -------------------- Comparing reorientation to ../_private/reorientation-FINAL-SAVE/ *UNIQUE items in reorientation: ... _thumbspage ... index.html Comparing contents _HOW-MADE.txt matches galaxys8-1N.jpg matches galaxys8-3U.jpg matches galaxys8-6R.jpg matches galaxys8-8L.jpg matches HEADER.html matches ipod6g-1N.JPG matches ipod6g-3U.JPG matches ipod6g-6R.JPG matches ipod6g-8L.JPG matches restore-originals.py matches sonydsc-1N.JPG matches sonydsc-3U.JPG matches sonydsc-6R.JPG matches sonydsc-8L.JPG matches untagged1-jpg.jpg matches untagged2-scan.jpg matches untagged3-gif.gif matches untagged4-png.png matches ================================================================================ Runtime hrs:mins:secs = 0:0:0.06 Dirs checked 1, Files checked: 19, Files skipped: 0 System metadata (cruft) files were skipped Diffs found: 1 - items UNIQUE at [reorientation] - [../_private/reorientation-FINAL-SAVE/] End of report. -------------------------------------------------------------------------------- 5) PROVE that no changes to prior clients with no tilted photos (diffall) -------------------------------------------------------------------------------- # copy folder ~/MY-STUFF/Code/thumbspage/examples$ cd ~/Desktop/ ~/Desktop$ cp -r /MY-STUFF/Websites/UNION/trnpix . # run thumbspage ~/Desktop$ py3 /MY-STUFF/Code/thumbspage/thumbspage.py Images folder path [. or dir] (enter=.)? trnpix Clean thumbs folder [y or n] (enter=y)? y Thumbs per row [int] (enter=4)? Thumb max size [x, y] (enter=(100, 100))? Use image-viewer pages [y or n] (enter=y)? y Running ... Finished: see the results in the images folder, trnpix. # compare to original ~/Desktop$ py3 /MY-STUFF/Code/mergeall/diffall.py trnpix/ /MY-STUFF/Websites/UNION/trnpix/ -skipcruft -------------------- Comparing trnpix/ to /MY-STUFF/Websites/UNION/trnpix/ ... you-are-here.png.html matches ================================================================================ Runtime hrs:mins:secs = 0:0:0.25 Dirs checked 4, Files checked: 347, Files skipped: 0 System metadata (cruft) files were skipped No diffs found. End of report.