mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-24 07:05:47 -07:00
Update Upload.php
This commit is contained in:
parent
317e29fbd5
commit
522d89993b
1 changed files with 5 additions and 2 deletions
|
@ -9,6 +9,9 @@
|
||||||
|
|
||||||
namespace TorrentPier\Common;
|
namespace TorrentPier\Common;
|
||||||
|
|
||||||
|
use claviska\SimpleImage;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Upload
|
* Class Upload
|
||||||
* @package TorrentPier\Common
|
* @package TorrentPier\Common
|
||||||
|
@ -165,14 +168,14 @@ class Upload
|
||||||
if (($this->cfg['max_width'] && $width > $this->cfg['max_width']) || ($this->cfg['max_height'] && $height > $this->cfg['max_height'])) {
|
if (($this->cfg['max_width'] && $width > $this->cfg['max_width']) || ($this->cfg['max_height'] && $height > $this->cfg['max_height'])) {
|
||||||
for ($i = 0, $max_try = 3; $i <= $max_try; $i++) {
|
for ($i = 0, $max_try = 3; $i <= $max_try; $i++) {
|
||||||
try {
|
try {
|
||||||
$image = new \claviska\SimpleImage();
|
$image = new SimpleImage();
|
||||||
$image
|
$image
|
||||||
->fromFile($this->file['tmp_name'])
|
->fromFile($this->file['tmp_name'])
|
||||||
->autoOrient()
|
->autoOrient()
|
||||||
->resize($this->cfg['max_width'], $this->cfg['max_height'])
|
->resize($this->cfg['max_width'], $this->cfg['max_height'])
|
||||||
->toFile($this->file['tmp_name']);
|
->toFile($this->file['tmp_name']);
|
||||||
break;
|
break;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
if ($i == $max_try) {
|
if ($i == $max_try) {
|
||||||
$this->errors[] = sprintf($lang['UPLOAD_ERROR_DIMENSIONS'], $this->cfg['max_width'], $this->cfg['max_height']);
|
$this->errors[] = sprintf($lang['UPLOAD_ERROR_DIMENSIONS'], $this->cfg['max_width'], $this->cfg['max_height']);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue