mirror of
https://github.com/openvk/openvk
synced 2024-11-14 11:09:12 +03:00
Photos: Increase possible wideness/tallness of image to k=7
This commit is contained in:
parent
b47d0dcd48
commit
829b3d1fbc
1 changed files with 4 additions and 2 deletions
|
@ -9,11 +9,13 @@ class Photo extends Media
|
||||||
protected $tableName = "photos";
|
protected $tableName = "photos";
|
||||||
protected $fileExtension = "jpeg";
|
protected $fileExtension = "jpeg";
|
||||||
|
|
||||||
|
const ALLOWED_SIDE_MULTIPLIER = 7;
|
||||||
|
|
||||||
protected function saveFile(string $filename, string $hash): bool
|
protected function saveFile(string $filename, string $hash): bool
|
||||||
{
|
{
|
||||||
$image = Image::fromFile($filename);
|
$image = Image::fromFile($filename);
|
||||||
if(($image->height >= ($image->width * pi())) || ($image->width >= ($image->height * pi())))
|
if(($image->height >= ($image->width * Photo::ALLOWED_SIDE_MULTIPLIER)) || ($image->width >= ($image->height * Photo::ALLOWED_SIDE_MULTIPLIER)))
|
||||||
throw new ISE("Invalid layout: expected layout that matches (x, ?!>3x)");
|
throw new ISE("Invalid layout: image is too wide/short");
|
||||||
|
|
||||||
$image->save($this->pathFromHash($hash), 92, Image::JPEG);
|
$image->save($this->pathFromHash($hash), 92, Image::JPEG);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue