Browse Source

dummy camera

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
6216b23f2d
1 changed files with 27 additions and 1 deletions
  1. 27
    1
      app/Http/Business/Cameras/DummyCamera.php

+ 27
- 1
app/Http/Business/Cameras/DummyCamera.php View File

9
 namespace App\Http\Business\Cameras;
9
 namespace App\Http\Business\Cameras;
10
 
10
 
11
 
11
 
12
+use App\Http\DBO\CamerasDbo;
12
 use App\Http\DBO\CamerasImageDbo;
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
 class DummyCamera extends AbstractCamera
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
      * @return CamerasImageDbo
39
      * @return CamerasImageDbo
18
      */
40
      */
19
     public function getImage()
41
     public function getImage()
20
     {
42
     {
21
         $imageDbo = new CamerasImageDbo();
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
         return $imageDbo;
49
         return $imageDbo;
24
     }
50
     }
25
 }
51
 }

Loading…
Cancel
Save