Generates HTML pages
(examples here)
for webcam images stored in a directory structure like this:
YYYY/MM/DD/YYYYMMDDHHMMSS.jpg
:
2023
├── 01
│ ├── 01
│ │ ├── 20230101000000.jpg
│ │ ├── 20230101001000.jpg
│ │ ├── 20230101002000.jpg
[...]
├── 12
│ │ ├── 20231231000000.jpg
│ │ ├── 20231231001000.jpg
│ │ ├── 20231231002000.jpg
[...]
- Finds sunrise, sunset, dawn, and dusk based on latitude and longitude.
- Only shows images taken between dawn and dusk, handles midnight sun and polar night.
- Navigation with touch gestures and arrow keys.
- Shows the time (HH:MM) as a CSS overlay on thumbails when viewing a full day, month and year.
- Data collection with Google Analytics and Microsoft Clarity
Example: Lillevik Lofoten webcam
If you like this you can buy me a coffee ☕️ (you'll be the first)
- Edit
copy-latest-image.sh
andrename_and_make_mini_images.sh
. - Add cron jobs for those two scripts. See crontab.txt.
- Edit the filename in
check_and_rename_files_hack()
that covers for cron when it's too slow. - Update latitude and longitude (use Google Maps to find coordinates)
- Verify the calculated sunrise and sunset at yr.no.
- Update the dates in functions
midnight_sun()
andpolar_night()
. - Change the code for Google and Analytics Microsoft Clarity.
- Update the HTML meta tags.
For verbose feedback for debugging: $debug = 1
.
Please note: The script started as a simple hack, then grew into this much larger and barely maintainable hack. It works well, but the code is not super elegant. PRs are welcome.
The Bash script
webcam-image-organize-fix.sh
can be a good starting point
for reorganizing thousands of images into YYYY/MM/DD
directories.
To Bash script
util/nctpput-all-images.sh
uses
ncftp
and can be a good starting point for mass-uploading thousands of files.
Resized to fit.
A single image: https://lilleviklofoten.no/webcam/?type=one&image=20231126151113
One full day: https://lilleviklofoten.no/webcam/?type=day&date=20231126
One full month: https://lilleviklofoten.no/webcam/?type=month&year=2023&month=11