| @@ 481-497 (lines=17) @@ | ||
| 478 | * |
|
| 479 | * @return bool |
|
| 480 | */ |
|
| 481 | public function checkMaxWidth() |
|
| 482 | { |
|
| 483 | if (!isset($this->maxWidth)) { |
|
| 484 | return true; |
|
| 485 | } |
|
| 486 | if (false !== $dimension = getimagesize($this->mediaTmpName)) { |
|
| 487 | if ($dimension[0] > $this->maxWidth) { |
|
| 488 | $this->setErrors(sprintf(_ER_UP_FILEWIDTHTOOLARGE, $this->maxWidth, $dimension[0])); |
|
| 489 | ||
| 490 | return false; |
|
| 491 | } |
|
| 492 | } else { |
|
| 493 | trigger_error(sprintf(_ER_UP_FAILEDFETCHIMAGESIZE, $this->mediaTmpName), E_USER_WARNING); |
|
| 494 | } |
|
| 495 | ||
| 496 | return true; |
|
| 497 | } |
|
| 498 | ||
| 499 | /** |
|
| 500 | * Is the picture the right height? |
|
| @@ 504-520 (lines=17) @@ | ||
| 501 | * |
|
| 502 | * @return bool |
|
| 503 | */ |
|
| 504 | public function checkMaxHeight() |
|
| 505 | { |
|
| 506 | if (!isset($this->maxHeight)) { |
|
| 507 | return true; |
|
| 508 | } |
|
| 509 | if (false !== $dimension = getimagesize($this->mediaTmpName)) { |
|
| 510 | if ($dimension[1] > $this->maxHeight) { |
|
| 511 | $this->setErrors(sprintf(_ER_UP_FILEHEIGHTTOOLARGE, $this->maxHeight, $dimension[1])); |
|
| 512 | ||
| 513 | return false; |
|
| 514 | } |
|
| 515 | } else { |
|
| 516 | trigger_error(sprintf(_ER_UP_FAILEDFETCHIMAGESIZE, $this->mediaTmpName), E_USER_WARNING); |
|
| 517 | } |
|
| 518 | ||
| 519 | return true; |
|
| 520 | } |
|
| 521 | ||
| 522 | /** |
|
| 523 | * Check whether or not the uploaded file type is allowed |
|