123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /**
- * Created by PhpStorm.
- * User: robin
- * Date: 11/24/15
- * Time: 12:56 PM
- */
-
- namespace App\Http\Business\Cameras;
-
-
- use App\Http\DBO\CamerasDbo;
- use App\Http\DBO\CamerasImageDbo;
- use Imagine\Image\Box;
- use Imagine\Image\Palette\RGB;
- use Imagine\Image\Point;
- use Imagine\Imagick\Image;
- use Imagine\Imagick\Imagine;
-
- class DummyCamera extends AbstractCamera
- {
- /**
- * @var $_image Image
- */
- private $_image;
- /**
- * @var $_imagine Imagine
- */
- private $_imagine;
-
- public function __construct(CamerasDbo $camera)
- {
- parent::__construct($camera);
- $this->_imagine = new Imagine();
- $this->_image = $this->_imagine->open("../resources/images/dummy_camera.jpg");
- }
-
- /**
- * @return CamerasImageDbo
- */
- public function getImage()
- {
- $imageDbo = new CamerasImageDbo();
- $draw = $this->_image->draw();
- $palette = new RGB();
- $radius = rand(10, 42);
- $draw->ellipse(new Point(42, 42), new Box($radius, $radius), $palette->color('#ff0000'));
- $imageDbo->setImage(base64_encode($this->_image->get("jpeg")));
- return $imageDbo;
- }
- }
|