-
Notifications
You must be signed in to change notification settings - Fork 4
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 #25 from mirko-pagliai/develop
Develop
- Loading branch information
Showing
17 changed files
with
647 additions
and
67 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
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
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 |
---|---|---|
@@ -1,35 +1,59 @@ | ||
# LANGUAGE translation of CakePHP Application | ||
# Copyright YEAR NAME <EMAIL@ADDRESS> | ||
# LANGUAGE translation of cakephp-thumber | ||
# Copyright 2017 Mirko Pagliai <mirko.pagliai@gmail.com> | ||
# | ||
#, fuzzy | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"POT-Creation-Date: 2017-03-17 21:00+0100\n" | ||
"POT-Creation-Date: 2017-12-29 15:18+0100\n" | ||
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" | ||
"Last-Translator: NAME <EMAIL@ADDRESS>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Controller/ThumbsController.php:45 | ||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/ThumbTrait.php:120 | ||
msgid "File `{0}` not readable" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Controller/ThumbsController.php:37 | ||
msgid "File `{0}` doesn't exist" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Utility/ThumbCreator.php:144 | ||
msgid "File `{0}` not readable" | ||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Shell/ThumberShell.php:41 | ||
msgid "Error deleting thumbnails" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Utility/ThumbCreator.php:269 | ||
msgid "No valid method called before the `{0}` method" | ||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Shell/ThumberShell.php:46 | ||
msgid "Thumbnails deleted: {0}" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Shell/ThumberShell.php:80 | ||
msgid "Clears all thumbnails that have been generated from an image path" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Shell/ThumberShell.php:84 | ||
msgid "Path of the original image" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Shell/ThumberShell.php:90 | ||
msgid "Clears all thumbnails" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Shell/ThumberShell.php:91 | ||
msgid "A shell to manage thumbnails" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Utility/ThumbCreator.php:299 | ||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Utility/ThumbCreator.php:107 | ||
msgid "Unable to read image from file `{0}`" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Utility/ThumbCreator.php:313 | ||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Utility/ThumbCreator.php:229 | ||
msgid "No valid method called before the `{0}` method" | ||
msgstr "" | ||
|
||
#: /home/mirko/Libs/Plugins/cakephp-thumber/src/Utility/ThumbCreator.php:260 | ||
msgid "The directory `{0}` is not writeable" | ||
msgstr "" | ||
|
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,95 @@ | ||
<?php | ||
/** | ||
* This file is part of cakephp-thumber. | ||
* | ||
* Licensed under The MIT License | ||
* For full copyright and license information, please see the LICENSE.txt | ||
* Redistributions of files must retain the above copyright notice. | ||
* | ||
* @copyright Copyright (c) Mirko Pagliai | ||
* @link https://github.com/mirko-pagliai/cakephp-thumber | ||
* @license https://opensource.org/licenses/mit-license.php MIT License | ||
* @since 1.3.0 | ||
*/ | ||
namespace Thumber\Shell; | ||
|
||
use Cake\Console\Shell; | ||
use Thumber\Utility\ThumbManager; | ||
|
||
/** | ||
* A shell to manage thumbnails | ||
*/ | ||
class ThumberShell extends Shell | ||
{ | ||
/** | ||
* Internal method to clears thumbnails | ||
* @param string $method Method to call, provided by the `ThumbManager` class | ||
* @param array $args Arguments | ||
* @return bool | ||
* @uses Thumber\Utility\ThumbManager::clear() | ||
* @uses Thumber\Utility\ThumbManager::clearAll() | ||
*/ | ||
protected function _clear($method, $args = []) | ||
{ | ||
try { | ||
$count = call_user_func_array([new ThumbManager, $method], (array)$args); | ||
} catch (\Exception $e) { | ||
$count = false; | ||
} | ||
|
||
if ($count === false) { | ||
$this->err(__d('thumber', 'Error deleting thumbnails')); | ||
|
||
return false; | ||
} | ||
|
||
$this->verbose(__d('thumber', 'Thumbnails deleted: {0}', $count)); | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Clears all thumbnails that have been generated from an image path | ||
* @param string $path Path of the original image | ||
* @return bool | ||
* @uses _clear() | ||
*/ | ||
public function clear($path = null) | ||
{ | ||
return $this->_clear(__FUNCTION__, $path); | ||
} | ||
|
||
/** | ||
* Clears all thumbnails | ||
* @return bool | ||
* @uses _clear() | ||
*/ | ||
public function clearAll() | ||
{ | ||
return $this->_clear(__FUNCTION__); | ||
} | ||
|
||
/** | ||
* Gets the option parser instance and configures it | ||
* @return ConsoleOptionParser | ||
*/ | ||
public function getOptionParser() | ||
{ | ||
$parser = parent::getOptionParser(); | ||
$parser->addSubcommand('clear', [ | ||
'help' => __d('thumber', 'Clears all thumbnails that have been generated from an image path'), | ||
'parser' => [ | ||
'arguments' => [ | ||
'path' => [ | ||
'help' => __d('thumber', 'Path of the original image'), | ||
'required' => true, | ||
], | ||
], | ||
], | ||
]); | ||
$parser->addSubcommand('clearAll', ['help' => __d('thumber', 'Clears all thumbnails')]); | ||
$parser->setDescription(__d('thumber', 'A shell to manage thumbnails')); | ||
|
||
return $parser; | ||
} | ||
} |
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
Oops, something went wrong.