Expand gallery functionality to automatic generation of index, slideshow and map files

This commit is contained in:
2015-12-20 20:55:12 +00:00
parent 56ea4df2aa
commit 4e89402a2a
12 changed files with 150 additions and 363 deletions

View File

@@ -0,0 +1,23 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Yaml\Yaml;
writeMetaYaml($argv[1]);
function writeMetaYaml($sDir) {
$sDir = rtrim($sDir, '"\'/\\');
$aMeta = [
'gallery' => ['name' => '', 'title' => '', 'description' => ''],
'files' => null
];
if (!is_dir($sDir)) {
die('Directory does not exist');
}
$aFiles = glob($sDir . '/*.jpg');
foreach ($aFiles as $sFile) {
$aMeta['files'][basename($sFile)] = ['title' => '', 'comment' => ''];
}
$sYaml = str_replace("''", null, Yaml::dump($aMeta, 4, 2));
file_put_contents($sDir . '/meta.yaml', $sYaml);
}