non-GUI status dialog for php command line interface scripting
Just drop this in a folder that contains files of the extension JPG and it will display them all in your shell.
The following is an example if you wanted to resize every JPG you own to a max of 1600 pixels in either width or height - whichever comes first.
<?php
$rand = md5(date("U"));
exec("find . -name '*.JPG' > $rand.txt");
$a_jpgs = file("$rand.txt");
$num_jpgs = count($a_jpgs);
$cnt = 1;
foreach($a_jpgs as $jpg)
{
$jpg = preg_replace("/\n$/","",$jpg);
$percent_completed = floor(($cnt/$num_jpgs)*100);
$files_left = $num_jpgs - $cnt;
system("clear");
print <<<eof
[{$percent_completed}% completed - $cnt of $num_jpgs files - $files_left files left]
/usr/bin/mogrify -resize 1600x1600 -size 1600x1600 "$jpg"\n
eof;
$cnt++;
}
?>
$rand = md5(date("U"));
exec("find . -name '*.JPG' > $rand.txt");
$a_jpgs = file("$rand.txt");
$num_jpgs = count($a_jpgs);
$cnt = 1;
foreach($a_jpgs as $jpg)
{
$jpg = preg_replace("/\n$/","",$jpg);
$percent_completed = floor(($cnt/$num_jpgs)*100);
$files_left = $num_jpgs - $cnt;
system("clear");
print <<<eof
[{$percent_completed}% completed - $cnt of $num_jpgs files - $files_left files left]
/usr/bin/mogrify -resize 1600x1600 -size 1600x1600 "$jpg"\n
eof;
$cnt++;
}
?>
[Click to add or edit comments])
Please prepend comments below including a date