Robin Thoni 9 лет назад
Родитель
Сommit
6216b23f2d
1 измененных файлов: 27 добавлений и 1 удалений
  1. 27
    1
      app/Http/Business/Cameras/DummyCamera.php

+ 27
- 1
app/Http/Business/Cameras/DummyCamera.php Просмотреть файл

@@ -9,17 +9,43 @@
9 9
 namespace App\Http\Business\Cameras;
10 10
 
11 11
 
12
+use App\Http\DBO\CamerasDbo;
12 13
 use App\Http\DBO\CamerasImageDbo;
14
+use Imagine\Image\Box;
15
+use Imagine\Image\Palette\RGB;
16
+use Imagine\Image\Point;
17
+use Imagine\Imagick\Image;
18
+use Imagine\Imagick\Imagine;
13 19
 
14 20
 class DummyCamera extends AbstractCamera
15 21
 {
22
+    /**
23
+     * @var $_image Image
24
+     */
25
+    private $_image;
26
+    /**
27
+     * @var $_imagine Imagine
28
+     */
29
+    private $_imagine;
30
+
31
+    public function __construct(CamerasDbo $camera)
32
+    {
33
+        parent::__construct($camera);
34
+        $this->_imagine = new Imagine();
35
+        $this->_image = $this->_imagine->open("../resources/images/dummy_camera.jpg");
36
+    }
37
+
16 38
     /**
17 39
      * @return CamerasImageDbo
18 40
      */
19 41
     public function getImage()
20 42
     {
21 43
         $imageDbo = new CamerasImageDbo();
22
-        $imageDbo->setImage(42);
44
+        $draw = $this->_image->draw();
45
+        $palette = new RGB();
46
+        $radius = rand(10, 42);
47
+        $draw->ellipse(new Point(42, 42), new Box($radius, $radius), $palette->color('#ff0000'));
48
+        $imageDbo->setImage(base64_encode($this->_image->get("jpeg")));
23 49
         return $imageDbo;
24 50
     }
25 51
 }

Загрузка…
Отмена
Сохранить