Implementing interlaced image upload

This commit is contained in:
Dennis Eichhorn 2016-12-07 19:00:00 +01:00
parent 85b5b62c70
commit 093f7fb831

View File

@ -33,6 +33,14 @@ class UploadFile
{
const PATH_GENERATION_LIMIT = 1000;
/**
* Image interlaced.
*
* @var int
* @since 1.0.0
*/
private $interlaced = true;
/**
* Upload max size.
*
@ -179,6 +187,14 @@ class UploadFile
return $result;
}
if($this->interlaced && in_array($extension, ['png', 'jpg', 'jpeg', 'gif'])) {
$img = fopen($f['tmp_name'], $path . '/' . $this->fileName);
flock($img, LOCK_EX);
imageinterlace($img, (int) $this->interlaced);
flock($img, LOCK_UN);
fclose($img);
}
$result[$key]['path'] = $this->outputDir;
}
@ -241,6 +257,11 @@ class UploadFile
return $this->maxSize;
}
public function setInterlaced(bool $interlaced) /* : void */
{
$this->interlaced = $interlaced;
}
/**
* @param int $maxSize
*