-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from jacobwalker0814/bin
Add basic executable
- Loading branch information
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
// Include autoloader | ||
require __DIR__.'/../../../autoload.php'; | ||
|
||
// Parse options from command line | ||
$opts = array_merge([ | ||
'f' => false, | ||
'r' => 1.0, // Resize factor 1.0 = 100% | ||
'w' => 0.75, // Dither treshold weight | ||
], getopt("f:r:w:ib")); | ||
|
||
// An image file/url is required. | ||
$opts['f'] || die("Must specify an image file.\n"); | ||
|
||
// The -i option inverts the image | ||
$image = Pixeler\Pixeler::image($opts['f'], $opts['r'], isset($opts['i']), $opts['w']); | ||
|
||
// No colors if "-b" is passed | ||
isset($opts['b']) && $image->clearColors(); | ||
|
||
// The Pixeler\Image instance render itself if casted to a string | ||
echo $image; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,6 @@ | |
"minimum-stability": "dev", | ||
"autoload": { | ||
"psr-4": { "Pixeler\\" : "" } | ||
} | ||
}, | ||
"bin": ["bin/pixeler"] | ||
} |