Add correction to generate photo ids without leading zero
This commit is contained in:
@@ -58,6 +58,7 @@ $oConsole
|
||||
foreach (glob($sDir . '/*.[jJ][pP][gG]') as $i => $sFile) {
|
||||
// Generate id from file contents
|
||||
$sId = substr(sha1_file($sFile), 0, 7);
|
||||
$sId[0] = $sId[0] == '0' ? '1' : $sId[0];
|
||||
$oOutput->write('<info>' . $sId . '</info>');
|
||||
|
||||
// Parse selected EXIF data
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user