123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /**
- * Created by PhpStorm.
- * User: robin
- * Date: 11/24/15
- * Time: 12:53 PM
- */
-
- namespace app\Http\Business\Cameras;
-
- use App\Http\DBO\CamerasDbo;
- use App\Http\DBO\CamerasImageDbo;
- use Imagine\Image\Box;
- use Imagine\Imagick\Image;
- use Imagine\Imagick\Imagine;
-
- abstract class AbstractCamera
- {
- /**
- * @var CamerasDbo
- */
- protected $_camera;
- /**
- * @var $_imagine Imagine
- */
- protected $_imagine;
- /**
- * @var $_image Image
- */
- protected $_image;
-
- public function __construct(CamerasDbo $camera)
- {
- $this->_camera = $camera;
- $this->_imagine = new Imagine();
- }
-
- /**
- * @return CamerasImageDbo
- */
- public function getImage()
- {
- $this->prepareImage();
- $imageDbo = new CamerasImageDbo();
- $this->_image->resize(new Box(640, 360));
- $imageDbo->setImage(base64_encode($this->_image->get("jpeg")));
- return $imageDbo;
- }
-
- public abstract function prepareImage();
- }
|