Add header images from upcoming 2016-wales gallery
This commit is contained in:
12
_scripts/photo-ids.php
Normal file
12
_scripts/photo-ids.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if (!isset($argv[1]) || !is_dir($argv[1])) {
|
||||
die('No directory given');
|
||||
}
|
||||
$sPath = realpath($argv[1]);
|
||||
foreach (glob($sPath . '/*.jpg') as $sFile) {
|
||||
$sId = substr(sha1_file($sFile), 0, 7);
|
||||
$sBasename = basename($sFile, '.jpg');
|
||||
printf("%s => %s\n", $sBasename, $sId);
|
||||
$sNewFile = str_replace($sBasename, $sId, $sFile);
|
||||
rename($sFile, $sNewFile);
|
||||
}
|
||||
Reference in New Issue
Block a user