Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Keep Item_Model::scale_dimensions from upscaling. Fixes #1579.

  • Loading branch information...
commit e2b0f92007eb9ef2fad994c9f8957df0bfcbeccf 1 parent b8124ef
@bharat bharat authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 modules/gallery/models/item.php
View
6 modules/gallery/models/item.php
@@ -653,7 +653,7 @@ public function thumb_img($extra_attrs=array(), $max=null, $center_vertically=fa
/**
* Calculate the largest width/height that fits inside the given maximum, while preserving the
- * aspect ratio.
+ * aspect ratio. Don't upscale.
* @param int $max Maximum size of the largest dimension
* @return array
*/
@@ -661,6 +661,10 @@ public function scale_dimensions($max) {
$width = $this->thumb_width;
$height = $this->thumb_height;
+ if ($width <= $max && $height <= $max) {
+ return array($height, $width);
+ }
+
if ($height) {
if (isset($max)) {
if ($width > $height) {
Please sign in to comment.
Something went wrong with that request. Please try again.