1212
1313namespace chillerlan \Imagetiler ;
1414
15- use chillerlan \Traits \ ContainerInterface ;
15+ use chillerlan \Settings \ SettingsContainerInterface ;
1616use ImageOptimizer \Optimizer ;
1717use Imagick ;
1818use Psr \Log \{LoggerAwareInterface , LoggerAwareTrait , LoggerInterface , NullLogger };
@@ -33,13 +33,13 @@ class Imagetiler implements LoggerAwareInterface{
3333 /**
3434 * Imagetiler constructor.
3535 *
36- * @param \chillerlan\Traits\ContainerInterface |null $options
36+ * @param \chillerlan\Settings\SettingsContainerInterface |null $options
3737 * @param \ImageOptimizer\Optimizer $optimizer
3838 * @param \Psr\Log\LoggerInterface|null $logger
3939 *
4040 * @throws \chillerlan\Imagetiler\ImagetilerException
4141 */
42- public function __construct (ContainerInterface $ options = null , Optimizer $ optimizer = null , LoggerInterface $ logger = null ){
42+ public function __construct (SettingsContainerInterface $ options = null , Optimizer $ optimizer = null , LoggerInterface $ logger = null ){
4343
4444 if (!extension_loaded ('imagick ' )){
4545 throw new ImagetilerException ('Imagick extension is not available ' );
@@ -54,23 +54,12 @@ public function __construct(ContainerInterface $options = null, Optimizer $optim
5454 }
5555
5656 /**
57- * @param \chillerlan\Traits\ContainerInterface $options
57+ * @param \chillerlan\Settings\SettingsContainerInterface $options
5858 *
5959 * @return \chillerlan\Imagetiler\Imagetiler
6060 * @throws \chillerlan\Imagetiler\ImagetilerException
6161 */
62- public function setOptions (ContainerInterface $ options ):Imagetiler {
63- $ options ->zoom_min = max (0 , $ options ->zoom_min );
64- $ options ->zoom_max = max (1 , $ options ->zoom_max );
65-
66- if ($ options ->zoom_normalize === null || $ options ->zoom_max < $ options ->zoom_normalize ){
67- $ options ->zoom_normalize = $ options ->zoom_max ;
68- }
69-
70- if ($ options ->tile_ext === null ){
71- $ options ->tile_ext = $ this ->getExtension ($ options ->tile_format );
72- }
73-
62+ public function setOptions (SettingsContainerInterface $ options ):Imagetiler {
7463 $ this ->options = $ options ;
7564
7665 if (ini_set ('memory_limit ' , $ this ->options ->memory_limit ) === false ){
@@ -86,7 +75,6 @@ public function setOptions(ContainerInterface $options):Imagetiler{
8675 putenv ('MAGICK_TEMPORARY_PATH= ' .$ this ->options ->imagick_tmp );
8776 }
8877
89-
9078 return $ this ;
9179 }
9280
@@ -350,25 +338,4 @@ protected function getSize(int $width, int $height, int $zoom):array{
350338 return [$ width , $ height ];
351339 }
352340
353- /**
354- * return file extension depend of given format
355- *
356- * @param string $format
357- *
358- * @return string
359- * @throws \chillerlan\Imagetiler\ImagetilerException
360- */
361- protected function getExtension (string $ format ):string {
362-
363- if (in_array ($ format , ['jpeg ' , 'jp2 ' , 'jpc ' , 'jxr ' ,], true )){
364- return 'jpg ' ;
365- }
366-
367- if (in_array ($ format , ['png ' , 'png00 ' , 'png8 ' , 'png24 ' , 'png32 ' , 'png64 ' ,], true )){
368- return 'png ' ;
369- }
370-
371- throw new ImagetilerException ('invalid file format ' );
372- }
373-
374341}
0 commit comments