Add correction to generate photo ids without leading zero

This commit is contained in:
2016-10-26 14:49:42 +01:00
parent 1ace4f136c
commit cde95c7499
2 changed files with 3 additions and 1 deletions

View File

@@ -4,7 +4,8 @@ if (!isset($argv[1]) || !is_dir($argv[1])) {
}
$sPath = realpath($argv[1]);
foreach (glob($sPath . '/*.jpg') as $sFile) {
$sId = substr(sha1_file($sFile), 0, 7);
$sId = substr(sha1_file($sFile), 0, 7);
$sId[0] = $sId[0] == '0' ? '1' : $sId[0];
$sBasename = basename($sFile, '.jpg');
printf("%s => %s\n", $sBasename, $sId);
$sNewFile = str_replace($sBasename, $sId, $sFile);