mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-18 10:18:41 +00:00
Implementing interlaced image upload
This commit is contained in:
parent
85b5b62c70
commit
093f7fb831
|
|
@ -33,6 +33,14 @@ class UploadFile
|
||||||
{
|
{
|
||||||
const PATH_GENERATION_LIMIT = 1000;
|
const PATH_GENERATION_LIMIT = 1000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image interlaced.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private $interlaced = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload max size.
|
* Upload max size.
|
||||||
*
|
*
|
||||||
|
|
@ -179,6 +187,14 @@ class UploadFile
|
||||||
return $result;
|
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;
|
$result[$key]['path'] = $this->outputDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,6 +257,11 @@ class UploadFile
|
||||||
return $this->maxSize;
|
return $this->maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setInterlaced(bool $interlaced) /* : void */
|
||||||
|
{
|
||||||
|
$this->interlaced = $interlaced;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $maxSize
|
* @param int $maxSize
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user