mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +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 $fileExtension = "jpeg";
|
||||
|
||||
const ALLOWED_SIDE_MULTIPLIER = 7;
|
||||
|
||||
protected function saveFile(string $filename, string $hash): bool
|
||||
{
|
||||
$image = Image::fromFile($filename);
|
||||
if(($image->height >= ($image->width * pi())) || ($image->width >= ($image->height * pi())))
|
||||
throw new ISE("Invalid layout: expected layout that matches (x, ?!>3x)");
|
||||
if(($image->height >= ($image->width * Photo::ALLOWED_SIDE_MULTIPLIER)) || ($image->width >= ($image->height * Photo::ALLOWED_SIDE_MULTIPLIER)))
|
||||
throw new ISE("Invalid layout: image is too wide/short");
|
||||
|
||||
$image->save($this->pathFromHash($hash), 92, Image::JPEG);
|
||||
|
||||
|
|
Loading…
Reference in a new issue