public __construct ( string $fileName, $options = [], $isDataStream = false ) : GdThumb | ||
$fileName | string | |
리턴 | GdThumb |
public function __construct($fileName, $options = array(), $isDataStream = false)
{
parent::__construct($fileName, $isDataStream);
$this->determineFormat();
if ($this->isDataStream === false) {
$this->verifyFormatCompatiblity();
}
switch ($this->format) {
case 'GIF':
$this->oldImage = imagecreatefromgif($this->fileName);
break;
case 'JPG':
$this->oldImage = imagecreatefromjpeg($this->fileName);
break;
case 'PNG':
$this->oldImage = imagecreatefrompng($this->fileName);
break;
case 'STRING':
$this->oldImage = imagecreatefromstring($this->fileName);
break;
}
$this->currentDimensions = array('width' => imagesx($this->oldImage), 'height' => imagesy($this->oldImage));
$this->setOptions($options);
// TODO: Port gatherImageMeta to a separate function that can be called to extract exif data
}
public function __construct($filename, $options = array(), $isDataStream = false) { $default = array('resizeUp' => true, 'jpegQuality' => 80, 'correctPermissions' => true, 'preserveAlpha' => true, 'alphaMaskColor' => array(255, 255, 255), 'preserveTransparency' => true, 'transparencyMaskColor' => array(0, 0, 0)); $options = array_merge($default, $options); parent::__construct($filename, $options, $isDataStream); }