summaryrefslogtreecommitdiff
path: root/htdocs/src
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/src')
-rw-r--r--htdocs/src/Post.inc.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/htdocs/src/Post.inc.php b/htdocs/src/Post.inc.php
index c844830..4386546 100644
--- a/htdocs/src/Post.inc.php
+++ b/htdocs/src/Post.inc.php
@@ -271,6 +271,25 @@ class Post {
}
// TODO Verify image dimensions?
+ if ($info[0] > self::MAX_IMAGE_WIDTH
+ or $info[1] > self::MAX_IMAGE_HEIGHT) {
+
+ $ratio = $info[0] / $info[1];
+
+ if ($ratio > 1) {
+ // Width limited
+ $width = min($info[0], self::MAX_IMAGE_WIDTH);
+ $height = $info[1] / $ratio;
+
+ } else {
+ // Height limited
+
+ }
+
+ $width = min($info[0], self::MAX_IMAGE_WIDTH);
+ $height = min($info[1], self::MAX_IMAGE_HEIGHT);
+
+ }
// Get image id
$db = getDatabase();