| 1 | <?php |
||
| 5 | class ImageManipulator |
||
| 6 | { |
||
| 7 | const FORMAT_JPG = 'jpg'; |
||
| 8 | const FORMAT_PNG = 'png'; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | protected $formats; |
||
| 14 | |||
| 15 | public function __construct() |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Initialize supported format and their callables |
||
| 22 | */ |
||
| 23 | protected function initializeFormatCallables() |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Formats image resource data to chosen format. |
||
| 33 | * |
||
| 34 | * @param resource $data |
||
| 35 | * @param string $format |
||
| 36 | * @param int $quality |
||
| 37 | * |
||
| 38 | * @return string |
||
| 39 | * |
||
| 40 | * @throws \InvalidArgumentException |
||
| 41 | */ |
||
| 42 | protected function formatImageData($data, $format, $quality = null) |
||
| 64 | } |
||
| 65 |