summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/helpers/graphics.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php
index 3d0c405d..e16b3086 100644
--- a/core/helpers/graphics.php
+++ b/core/helpers/graphics.php
@@ -153,9 +153,15 @@ class graphics_Core {
self::init_toolkit();
}
- Image::factory($input_file)
- ->resize($options["width"], $options["height"], $options["master"])
- ->save($output_file);
+ $dims = getimagesize($input_file);
+ if (max($dims[0], $dims[1]) < min($options["width"], $options["height"])) {
+ // Image would get upscaled; do nothing
+ copy($input_file, $output_file);
+ } else {
+ Image::factory($input_file)
+ ->resize($options["width"], $options["height"], $options["master"])
+ ->save($output_file);
+ }
}
/**