Skip to content
Snippets Groups Projects
Commit 93c7482b authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Merge pull request #454 from lisps/resize_image-height

Resize image by height
parents 0f569f4d e175e163
No related branches found
No related tags found
No related merge requests found
......@@ -1804,6 +1804,7 @@ function media_resize_image($file, $ext, $w, $h=0){
if($info == false) return $file; // that's no image - it's a spaceship!
if(!$h) $h = round(($w * $info[1]) / $info[0]);
if(!$w) $w = round(($h * $info[0]) / $info[1]);
// we wont scale up to infinity
if($w > 2000 || $h > 2000) return $file;
......
......@@ -78,8 +78,8 @@ if (defined('SIMPLE_TEST')) {
unset($evt);
//handle image resizing/cropping
if((substr($MIME, 0, 5) == 'image') && $WIDTH) {
if($HEIGHT) {
if((substr($MIME, 0, 5) == 'image') && ($WIDTH || $HEIGHT)) {
if($HEIGHT && $WDITH) {
$data['file'] = $FILE = media_crop_image($data['file'], $EXT, $WIDTH, $HEIGHT);
} else {
$data['file'] = $FILE = media_resize_image($data['file'], $EXT, $WIDTH, $HEIGHT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment