Maslosoft Mangan API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
<?php
/**
* This software package is licensed under AGPL or Commercial license.
*
* @package maslosoft/mangan
* @licence AGPL or Commercial
* @copyright Copyright (c) Piotr Masełkowski <pmaselkowski@gmail.com>
* @copyright Copyright (c) Maslosoft
* @copyright Copyright (c) Others as mentioned in code
* @link https://maslosoft.com/mangan/
*/
namespace Maslosoft\Mangan\Model;
/**
* Description of EMongoImageParams
* @since 2.0.2
* @property int $width Width of image
* @property int $height Height of image
* @property bool $adaptive If true adaptive (with crop) resize will be used, if false best match scalling will be used
* @property bool $isTemp This is to indicate that image is temporary, will be automatically set to true
* @author Piotr
*/
class ImageParams
{
use \Maslosoft\Mangan\Traits\Access\GetSet;
/**
*
* @var int
*/
private $_width = 0;
/**
*
* @var int
*/
private $_height = 0;
/**
* If true adaptive (with crop) resize will be used, if false best match scalling will be used
* @var bool
*/
private $_adaptive = false;
/**
* This is to indicate that image is temporary, this should set to true for thumbs etc.
* @var bool
*/
private $_isTemp = false;
public function toArray()
{
if ($this->_width || $this->_height)
{
// Get resized
return [
'width' => $this->getWidth(),
'height' => $this->getHeight(),
'adaptive' => $this->getAdaptive(),
'isTemp' => $this->getIsTemp()
];
}
else
{
// Get original image
return [
'isTemp' => false
];
}
}
public function getWidth()
{
return (int) $this->_width;
}
public function getHeight()
{
return (int) $this->_height;
}
public function getAdaptive()
{
return (bool) $this->_adaptive;
}
public function getIsTemp()
{
return $this->_isTemp;
}
public function setWidth($width)
{
$this->_width = $width;
return $this;
}
public function setHeight($height)
{
$this->_height = $height;
return $this;
}
public function setAdaptive($adaptive)
{
$this->_adaptive = $adaptive;
return $this;
}
public function setIsTemp($isTemp)
{
$this->_isTemp = $isTemp;
return $this;
}
}
API documentation generated by ApiGen