diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2011-06-17 11:41:14 -0700 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net ; true> | 2011-06-17 11:41:14 -0700 | 
| commit | ffcb9a0727f9040249ef55953e5bbe44b6c04ebc (patch) | |
| tree | fc72944a9c720175ad1a3088f614e7e1f12b3d04 | |
| parent | 4abea1ff10cc1376308ba590ee4e97091fc997e1 (diff) | |
Working on image resizing... not complete yet
| -rw-r--r-- | htdocs/src/Post.inc.php | 19 | 
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();  | 
