To write metadata in avif image files with Digikam, you have to set it in
settings – > metadata -> behavior, as in the attached image:

a thoughtful use of digital
To write metadata in avif image files with Digikam, you have to set it in
settings – > metadata -> behavior, as in the attached image:

You can add metadata to a website folder, i.g. adding in it a file, such as . folder, within write something like:
{
"description": "your description",
"order": 2
}
“order”: 2, in case you want that that folder be the second in your webpage
In the webpage you can retrieve the metadata info with a code like this:
<?php
$d = dir(".");
$folders = [];
// Array delle cartelle da escludere
$excludedDirs = ['excluded-dir', 'another-excluded-dir', 'yet-another-excluded-dir'];
while (false !== ($entry = $d->read())) {
// Controlla se l'entry è una directory e non è una delle cartelle da escludere
if (is_dir($entry) && ($entry != '.') && ($entry != '..') && !in_array($entry, $excludedDirs)) {
$metadataFile = $entry . '/.directory';
$metadata = [];
// Recupera i metadati dal file .directory
if (file_exists($metadataFile)) {
$metadata = json_decode(file_get_contents($metadataFile), true); // Leggi e decodifica il contenuto del file
}
// Aggiungi la cartella e i metadati all'array
$folders[] = [
'name' => $entry,
'displayName' => str_replace('-', ' ', $entry), // Sostituisci i trattini con spazi per la visualizzazione
'order' => isset($metadata['order']) ? $metadata['order'] : PHP_INT_MAX, // Usa un valore alto se non è specificato
'description' => isset($metadata['description']) ? $metadata['description'] : ''
];
}
}
// Ordina le cartelle in base all'attributo 'order'
usort($folders, function($a, $b) {
return $a['order'] <=> $b['order'];
});
echo "<h2>sotto-sezioni</h2>\n<ul>";
foreach ($folders as $folder) {
echo "<li order='{$folder['order']}'><a class='big' href='{$folder['name']}'>{$folder['displayName']}</a>";
if ($folder['description']) {
echo "<br /><p>{$folder['description']}</p>"; // Mostra la descrizione se presente
}
echo "</li>";
}
echo "</ul>";
$d->close();
?>
This is a good code:
<?php
echo "<ul class=\"flexmenu\">\n";
$phpfiles = glob("$path./[^index]*.php"); // Get all PHP files except index.php
foreach ($phpfiles as $phpfile) {
$contents = file_get_contents($phpfile);
preg_match('/\$title\s*=\s*"(.*?)";/', $contents, $titleMatch);
preg_match('/\$subtitle\s*=\s*"(.*?)";/', $contents, $subtitleMatch);
preg_match('/\$description\s*=\s*"(.*?)";/', $contents, $descriptionMatch);
preg_match('/\$order\s*=\s*"(.*?)";/', $contents, $orderMatch);
$title = $titleMatch[1] ?? 'No title';
$subtitle = $subtitleMatch[1] ?? 'No subtitle';
$order = $orderMatch[1] ?? '';
$description = $descriptionMatch[1] ?? 'No description';
// Correctly extract the filename
$filename = $phpfile; // Use basename on $phpfile directly
echo " <li role='menuitem' style=\"order:$order\"><a href=\"{$filename}\">{$title}</a>, <i>{$subtitle}</i>: {$description}</li>\n";
}
echo "</ul>";
?>
You can get the title of your files in that folder (useful if the name of the file would not suit for a list), the subtitle and description.
With the order variable you can set, in a flex list (and this is why is added a .flexmenu class: a no-flex list doesn’t order your items as expected, but alphabetically), in what order your files should appear.
Of course the title is linked with the matching file.