Add correction to generate photo ids without leading zero
This commit is contained in:
@@ -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