From ffcb9a0727f9040249ef55953e5bbe44b6c04ebc Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Fri, 17 Jun 2011 11:41:14 -0700 Subject: Working on image resizing... not complete yet --- htdocs/src/Post.inc.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'htdocs/src') 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(); -- cgit v1.2.3