From 3fe5bdbd8de265ffe558fb3c91eac64ccdd2d158 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Thu, 28 Jun 2012 10:33:21 -0600 Subject: [PATCH 1/2] add ability to set maximum pixel length of uploaded pictures --- boot.php | 18 ++++++++++++++++++ mod/photos.php | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/boot.php b/boot.php index 1983f44e7..4c42f19a7 100644 --- a/boot.php +++ b/boot.php @@ -34,6 +34,24 @@ define ( 'JPEG_QUALITY', 100 ); */ define ( 'PNG_QUALITY', 8 ); +/** + * + * An alternate way of limiting picture upload sizes. Specify the maximum pixel + * length that pictures are allowed to be (for non-square pictures, it will apply + * to the longest side). Pictures longer than this length will be resized to be + * this length (on the longest side, the other side will be scaled appropriately). + * Modify this value using + * + * $a->config['system']['max_image_length'] = n; + * + * in .htconfig.php + * + * If you don't want to set a maximum length, set to -1. The default value is + * defined by 'MAX_IMAGE_LENGTH' below. + * + */ +define ( 'MAX_IMAGE_LENGTH', -1 ); + /** * Not yet used diff --git a/mod/photos.php b/mod/photos.php index ea4d7f81f..624f0bdca 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -743,6 +743,12 @@ function photos_post(&$a) { $ph->orient($src); @unlink($src); + $max_length = get_config('system','max_image_length'); + if(! $max_length) + $max_length = MAX_IMAGE_LENGTH; + if($max_length > 0) + $ph->scaleImage($max_length); + $width = $ph->getWidth(); $height = $ph->getHeight(); From 424797138fc9f0d8ce62960c7f99878fe620440c Mon Sep 17 00:00:00 2001 From: "Zvi ben Yaakov (a.k.a rdc)" Date: Tue, 3 Jul 2012 21:49:02 +0300 Subject: [PATCH 2/2] Limiting .directory-photo-wrapper styles to
so as not to interfere with .directory-photo-wrapper in