1 <?php
 2 
 3 /**
 4  * Dreht ein Bild.
 5  *
 6  * @package redaxo\media-manager
 7  */
 8 class rex_effect_rotate extends rex_effect_abstract
 9 {
10     private $options;
11 
12     public function __construct()
13     {
14         $this->options = [
15             '0', '90', '180', '270',
16         ];
17     }
18 
19     public function execute()
20     {
21         $this->media->asImage();
22         $gdimage = $this->media->getImage();
23         $gdimage = imagerotate($gdimage, $this->params['rotate'], 0);
24         $this->media->setImage($gdimage);
25     }
26 
27     public function getName()
28     {
29         return rex_i18n::msg('media_manager_effect_rotate');
30     }
31 
32     public function getParams()
33     {
34         return [
35             [
36                 'label' => rex_i18n::msg('media_manager_effect_rotate_degree'),
37                 'name' => 'rotate',
38                 'type' => 'select',
39                 'options' => $this->options,
40                 'default' => '0',
41             ],
42         ];
43     }
44 }
45