QT6 CXX23 SCS to convert photos and add Metadata to Database
Table of Contents
QT6 C++23 Self Contained System (SCS) to convert photos, collect Exif/IPTC and add metadata to DB.
The purpose of this tool is to run as a microservice to prepare photos for a web-based photo-gallery.
Photos are converted into different sizes in WebP format and the metadata is written into a database.
Any existing Exif and IPTC metadata is also taken into account.
flowchart LR;
A["`local storage
**Photos**`"] --> B[[files to photo-db]]
B-- Metadata ---C[(**Database**)]
B-- "sql" ---D["`**SQL-File**
_insert into ..._`"]
B-- "convert & enrich" ---S[["`local storage
**./WebP-Photos**`"]]
- Webserver (SCS) for steering and managing
- supports PostgreSQL (insert)
- supports SQLite3 (incl. create tables, indexes, triggers; insert)
- supports exports to SQL-file ("native", system-independent SQL; insert)
- supports exports to csv-file
- Exchangeable Image File Format (Exif; read, write; sql insert)
- IPTC-IIM (IPTC; read, write; sql insert)
- converts images to several WebP / PNG sizes
- (db) password encryption
- Plugin-based System (eg. PG, SQLite3, EXIF/IPTC, WebP, PNG)
- advanced-extra-super-ultra-special feature xyz
- OSS and license
- works as designed
- no bugs
- some more or less usefull Github Actions for GH-repo, GH-pages, GH-wiki, CI/CD-Pipelines, Release-Mgmt.
- Package-Manager: Conan
- Buildsystem: CMake
- Clang-Tidy (cppcoreguidelines-*)
- Documentation: Doxygen (modern style)
- Installer: CMake
- Packaging: CPack (IFW;DEB;ZIP;TBZ2;RPM)
- graphical installer (QT6 IFW)
- portable application / runtime binaries (see Release)
- SBOM included (static; also Linux shell commands; GH-Action in work)
- separation of documentation (general Readme - detailed
/docs/*
) - configuration via YAML
- configuration via INI file
- runs on DOS/Windows
- runs on MacOS
- runs on Linux
- runs on iOS
- runs on Android
- runs on HarmonyOS
see also: Application Documentation
create ToC in Markdown files in folders
- .github/actions/**
- .github/workflows/**
- dist/**
- docs/**
bla bla ... everything easy and green with No Code/Low code and without any costs
All licenses are therefore GPL-compatible.
Conan, software package manager for C and C++ developers
CMake: A Powerful Software Build System
Code Documentation. Automated.
Doxygen Awesome is a custom CSS theme for Doxygen HTML documentation.
This theme is an attempt to update the visuals of Doxygen without changing its overall layout too much.
QT6 - Community Edition
The Qt framework contains a comprehensive set of highly intuitive and modularized C++ library classes and is loaded with APIs to simplify your application development. Qt produces highly readable, easily maintainable and reusable code with high runtime performance and small footprint – and it's cross-platform.
see also:Obligations of the GPL and LGPL
a lightweight C++ option parser library, supporting the standard GNU style syntax for options.
inifile-cpp is a simple and easy to use single header-only ini file en- and decoder for C++.
Note
included in src/includes
Plog - portable, simple and extensible C++ logging library
.
├── .github
│  ├── actions
│  │  └── doctoc
│  │  ├── README.md
│  │  ├── action.yml
│  │  └── dist
│  │  ├── index.js
│  │  ├── index.js.map
│  │  ├── licenses.txt
│  │  └── sourcemap-register.js
│  └── workflows
│  ├── ghp-create_doctoc.yml
│  ├── ghp-markdown_index.yml
│  ├── repo-actions_docu.yml
│  ├── repo-call_Readme.yml
│  ├── repo-create_doctoc.yml_
│  ├── repo-create_doctoc_md.yml
│  ├── repo-create_tree_readme.yml
│  └── repo-test_sbom.yml
├── .gitignore
├── LICENSE
├── README.md
├── dist
│  ├── README.md
│  ├── atom_usages_v0.1.5.json
│  ├── main.cpp_v0.1.4.svg
│  ├── qt_files_photo-gallery.ini
│  ├── sbom_v0.1.5.json
│  └── screenshot_graphical-installer_de.png
├── src
│  ├── CMAKEGraphVizOptions.cmake
│  ├── CMakeLists.txt
│  ├── conanfile.txt
│  ├── configure
│  │  ├── ClangTidy.cmake
│  │  ├── Doxygen.cmake
│  │  ├── extra_headers
│  │  └── rz_config.h.in
│  ├── includes
│  │  ├── httplib.h
│  │  ├── inicpp.h
│  │  ├── qaesencryption.cpp
│  │  ├── qaesencryption.h
│  │  ├── rz_aes.cpp
│  │  ├── rz_aes.h
│  │  ├── rz_datetime.cpp
│  │  ├── rz_datetime.hpp
│  │  ├── rz_do_thread.cpp
│  │  ├── rz_do_thread.hpp
│  │  ├── rz_filesystem.cpp
│  │  ├── rz_filesystem.hpp
│  │  ├── rz_inifile.cpp
│  │  ├── rz_inifile.hpp
│  │  ├── rz_options.hpp
│  │  ├── rz_output.cpp
│  │  ├── rz_output.hpp
│  │  ├── rz_pg_db.cpp
│  │  ├── rz_pg_db.hpp
│  │  ├── rz_photo-gallery_plugins.hpp
│  │  ├── rz_qt_snippets.cpp
│  │  ├── rz_qt_snippets.hpp
│  │  ├── rz_readdir.cpp
│  │  ├── rz_readdir.hpp
│  │  ├── rz_snippets.cpp
│  │  ├── rz_snippets.hpp
│  │  ├── rz_sqlite3_db.cpp
│  │  ├── rz_sqlite3_db.hpp
│  │  ├── rz_string_lib.hpp
│  │  └── rz_webserver.hpp
│  └── main.cpp
└── tree.bak
9 directories, 62 files
QT6
just load the project in QT Creator and run build or <release...>
cd src
conan install . --output-folder=../build --build=missing
cd ../build
cmake -S ../src -B . -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release
# cmake --build . --parallel <number of CPU cores>
cmake --build .
Note
generate Doxygen documentation with cd build && cmake --build . --target doxygen
cd build && sudo cpack -G "ZIP;DEB;RPM" -B packages
# or
cd build && sudo cmake --build . --target package
cd build && sudo cmake --build . --target package_source
depends on your system
rpm -i files_photo-gallery-0.1.5-Linux.rpm
dpkg -i files_photo-gallery-0.1.5-Linux.deb
unzip files_photo-gallery-0.1.5-Linux.zip
....
# graphical installer (QT6 IFW)
./files_photo-gallery-0.1.5-Linux.run
Installing the binary and all necessary dependency libs:
cd build && sudo cmake --install .
Important
still under construction.
Note
at least 1 parameter is required
-a
or-i <path to>/<ini file>
- use
-a
for shortcut - use
-a -e <env>
for shortcut - use
-i <path to>/<ini file>
- use
-i <path to>/<ini file> -e <env>
Important
still under construction.
Parameter | Type | Description |
---|---|---|
-a --auto |
none |
Optional: load Ini `//.config/.ini>`` |
-c --create |
string |
Optional: create Ini <path to>/<file.ini> or default: /<user home>/.config/<program>.ini> |
-e --env |
string |
Optional: <dev> , <int> , <prod> or default:dev |
-i --ini |
string |
Optional: <pathTo/inifile> |
-l --listini |
string |
Optional: <pathTo/inifile> or default: default: //.config/.ini>` |
-v --version |
string |
Optional: <program>-v<major>.<minor>.<patch> |
-h --help |
string |
Optional: list help menu |
-
exit(EXIT_SUCCESS)
orexit(EXIT_FAILURE)
-
PostgreSQL: inserted rows
-
SQLite3: created tables, indexes, triggers; inserted rows
-
SQL-File: created file with sql inserts
flowchart TD;
A["`local storage
**Photos**`"] --> P[[files to photo-db]]
P --> E[[Exif]] & I[[IPTC]] --> M(Photos)
M --> D[("`Database
**Metadata**`")] & Q["`**SQL-File**
_insert into ..._`"] & N[["`local storage
**converted Photos**
_./WebP/size a
./WebP/size b
./WebP/size..._`"]] --> C{OK?}
C ---->|No| F["**EXIT_FAILURE**"]
C ---->|Yes| O["**EXIT_SUCCESS**"]
Important
documentation is still under construction.
see also folder: dist
Note
generate Doxygen documentation with cd build && cmake --build . --target doxygen
under constrcution:
block-beta
columns 3
Repo:3
block:group1:1
columns 1
id0[".github"]
block:group2:1
columns 1
id1[["workflows"]]
id2[["actions"]]
end
end
dist src
block:group3:3
%% columns auto (default)
A["docs"] B["gh-pages"]
end
flowchart TD;
A[Workflow]-. parameter .->B[[callable Workflow]]
B-- parameter -->C[Action]
C-->D(README)
A[Workflow]-. parameter .->E[[callable Workflow]]
E-- parameter -->F[Action]
F-->J(Markdown files)
A[Workflow]-->K[[Workflow]]
K-->L[Action]
L-->M("GH-Pages")
- Webserver NGinx
- Appserver (Applicationserver) Rust Rocket
- Database PostgreSQL
- Storage (for Webserver static content as well as for Appserver Photo-Gallery management)
architecture-beta
group bounded_context(cloud)[Web Photo Gallery]
service server1(server)[Webserver] in bounded_context
service server2(server)[Appserver] in bounded_context
service db(database)[Database] in bounded_context
service disk1(disk)[Storage] in bounded_context
service disk2(disk)[Storage] in bounded_context
disk1:L -- R:server1
server1:T -- B:server2
disk2:L -- R:server2
db:B -- T:server2
- collecting local files
- read attributes (size, geometry)
- read Exif/IPTC (if present)
- write Metadata to DB|SQL-File
- convert files to WebP
flowchart LR;
A["`local storage
**Photos**`"] --> B[[files to photo-db]]
B-- Metadata ---C[(**Database**)]
B-- "sql" ---D["`**SQL-File**
_insert into ..._`"]
B-- "convert & enrich" ---S[["`local storage
**./WebP-Photos**`"]]
Note
at least 1 parameter is required:
-a
or -i <path to>/<ini file>
Tip
use -a
for shortcut
use -a -e <env>
for shortcut
use -i <path to>/<ini file>
use -i <path to>/<ini file> -e <env>
see dist/qt_files_photo-gallery.ini
Tip
call: <prog> -c
: create new Inifile
call: <prog> -l
: list existing Inifile
during build a SHA2-256 checksum is generated and stored
Note
see build/qt_files_photo-gallery.sha256sum
generate
sha256sum qt_files_photo-gallery > qt_files_photo-gallery.sha256sum
check
sha256sum --check qt_files_photo-gallery.sha256sum
generate
shasum -a 256 qt_files_photo-gallery > qt_files_photo-gallery.sha256sum
check
shasum --check qt_files_photo-gallery.sha256sum
Tip
create a file src/CMAKEGraphVizOptions.cmake
content of CMAKEGraphVizOptions.cmake
:
set(GRAPHVIZ_CUSTOM_TARGETS TRUE)
cd ../build
cmake --graphviz=qt_files_photo-gallery.dot .
goto https://dreampuf.github.io/GraphvizOnline/
and fill in the content of file qt_files_photo-gallery.dot
Note
A Github Action/Workflow to produce a SPDX/CycloneDX JSON SBoM during Release, is still under construction.
nvm use --lts
atom -J-Xmx16g usages -o app.atom --slice-outfile ./dist/atom_usages_v0.1.0.json -l cpp ./src
cdxgen -o ./dist/sbom_v0.1.0.json -t cpp --usages-slices-file ./dist/atom_usages_v0.1.0.json --author "ZHENG Robert" --deep -r ./src
Copyright (c) 2024 ZHENG Robert
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
🖖