git.cweiske.de
/
surrogator.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
90769e0
)
read filenames from cli
author
Christian Weiske
<cweiske@cweiske.de>
Thu, 16 Aug 2012 19:23:29 +0000
(21:23 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Thu, 16 Aug 2012 19:23:29 +0000
(21:23 +0200)
surrogator.php
patch
|
blob
|
history
diff --git
a/surrogator.php
b/surrogator.php
index 07556bb622025af0bad08216476d8be28f336258..460cfaa9188fb7d81c850895916c9863b8301c71 100755
(executable)
--- a/
surrogator.php
+++ b/
surrogator.php
@@
-95,11
+95,18
@@
foreach ($sizes as $size) {
}
}
}
}
-$dir = new \RegexIterator(
- new \DirectoryIterator($rawDir),
- '#^.+\.(png|jpg)$#'
-);
-foreach ($dir as $fileInfo) {
+if (count($files)) {
+ $fileInfos = array();
+ foreach ($files as $file) {
+ $fileInfos[] = new \SplFileInfo($file);
+ }
+} else {
+ $fileInfos = new \RegexIterator(
+ new \DirectoryIterator($rawDir),
+ '#^.+\.(png|jpg)$#'
+ );
+}
+foreach ($fileInfos as $fileInfo) {
$origPath = $fileInfo->getPathname();
$fileName = $fileInfo->getFilename();
$ext = strtolower(substr($fileName, strrpos($fileName, '.') + 1));
$origPath = $fileInfo->getPathname();
$fileName = $fileInfo->getFilename();
$ext = strtolower(substr($fileName, strrpos($fileName, '.') + 1));
@@
-127,6
+134,7
@@
foreach ($dir as $fileInfo) {
log(' sha256: ' . $sha256, 3);
$imgSquare = imagecreatefrompng($squarePath);
foreach ($sizes as $size) {
log(' sha256: ' . $sha256, 3);
$imgSquare = imagecreatefrompng($squarePath);
foreach ($sizes as $size) {
+ log(' size ' . $size, 3);
$sizePathMd5 = $varDir . '/' . $size . '/' . $md5 . '.png';
$sizePathSha256 = $varDir . '/' . $size . '/' . $sha256 . '.png';
$sizePathMd5 = $varDir . '/' . $size . '/' . $md5 . '.png';
$sizePathSha256 = $varDir . '/' . $size . '/' . $sha256 . '.png';