diff --git a/Models/UploadFile.php b/Models/UploadFile.php index 0585cd4..a6a30f5 100644 --- a/Models/UploadFile.php +++ b/Models/UploadFile.php @@ -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 *