選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

AbstractCamera.php 1002B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: robin
  5. * Date: 11/24/15
  6. * Time: 12:53 PM
  7. */
  8. namespace app\Http\Business\Cameras;
  9. use App\Http\DBO\CamerasDbo;
  10. use App\Http\DBO\CamerasImageDbo;
  11. use Imagine\Image\Box;
  12. use Imagine\Imagick\Image;
  13. use Imagine\Imagick\Imagine;
  14. abstract class AbstractCamera
  15. {
  16. /**
  17. * @var CamerasDbo
  18. */
  19. protected $_camera;
  20. /**
  21. * @var $_imagine Imagine
  22. */
  23. protected $_imagine;
  24. /**
  25. * @var $_image Image
  26. */
  27. protected $_image;
  28. public function __construct(CamerasDbo $camera)
  29. {
  30. $this->_camera = $camera;
  31. $this->_imagine = new Imagine();
  32. }
  33. /**
  34. * @return CamerasImageDbo
  35. */
  36. public function getImage()
  37. {
  38. $this->prepareImage();
  39. $imageDbo = new CamerasImageDbo();
  40. $this->_image->resize(new Box(640, 360));
  41. $imageDbo->setImage(base64_encode($this->_image->get("jpeg")));
  42. return $imageDbo;
  43. }
  44. public abstract function prepareImage();
  45. }