CC-3092: Station Information: not able to upload logo
- Adding a return statement fixed it...I don't what was I thinking... - Some indention seems messed up, fixed it
This commit is contained in:
parent
72553a257d
commit
8766cade49
1 changed files with 24 additions and 24 deletions
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||||
|
|
||||||
public function filter($value) {
|
public function filter($value) {
|
||||||
if (!file_exists($value)) {
|
if (!file_exists($value)) {
|
||||||
throw new Zend_Filter_Exception('Image does not exist: ' . $value);
|
throw new Zend_Filter_Exception('Image does not exist: ' . $value);
|
||||||
|
@ -17,11 +16,9 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||||
$origWidth = imagesx($image);
|
$origWidth = imagesx($image);
|
||||||
$origHeight = imagesy($image);
|
$origHeight = imagesy($image);
|
||||||
$ratio = max($origWidth, $origHeight) / 600;
|
$ratio = max($origWidth, $origHeight) / 600;
|
||||||
if($ratio < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a scaled down image
|
if ($ratio > 1) {
|
||||||
|
// img too big! create a scaled down image
|
||||||
$newWidth = round($origWidth / $ratio);
|
$newWidth = round($origWidth / $ratio);
|
||||||
$newHeight = round($origHeight / $ratio);
|
$newHeight = round($origHeight / $ratio);
|
||||||
$resized = imagecreatetruecolor($newWidth, $newHeight);
|
$resized = imagecreatetruecolor($newWidth, $newHeight);
|
||||||
|
@ -29,7 +26,7 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||||
|
|
||||||
// determine type and store to disk
|
// determine type and store to disk
|
||||||
$explodeResult = explode(".", $value);
|
$explodeResult = explode(".", $value);
|
||||||
$type = $explodeResult[count($explodeResult) - 1];
|
$type = strtolower($explodeResult[count($explodeResult) - 1]);
|
||||||
$writeFunc = 'image' . $type;
|
$writeFunc = 'image' . $type;
|
||||||
if ($type == 'jpeg' || $type == 'jpg') {
|
if ($type == 'jpeg' || $type == 'jpg') {
|
||||||
imagejpeg($resized, $value, 100);
|
imagejpeg($resized, $value, 100);
|
||||||
|
@ -37,6 +34,9 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||||
$writeFunc($resized, $value);
|
$writeFunc($resized, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue