aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-08-18 15:19:03 +0000
committerplegall <plg@piwigo.org>2011-08-18 15:19:03 +0000
commit27d0c89c337ee5a2281640d0fed68ed26c0a50e1 (patch)
treead6c21054706d7d81cc9fe541107100a51c565da /admin/include
parent71848746ba06480ed82811df2373faf75e6e563f (diff)
feature 2407 added: display upload limitations before file selection (file
maximum size, maximum dimensions, allowed file types). The maximum dimensions are calculated for GD only (because Imagick and External ImageMagick are not using PHP memory as far as I could find on the web). bug 2408 fixed: change term "old style form" into "browser uploader" and "multiple file form" into "Flash Uploader" (based on WordPress user interface) git-svn-id: http://piwigo.org/svn/trunk@11966 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include')
-rw-r--r--admin/include/photos_add_direct_prepare.inc.php53
-rw-r--r--admin/include/uploadify/uploadify.css1
2 files changed, 49 insertions, 5 deletions
diff --git a/admin/include/photos_add_direct_prepare.inc.php b/admin/include/photos_add_direct_prepare.inc.php
index 2cfb2f55c..34a5f79b7 100644
--- a/admin/include/photos_add_direct_prepare.inc.php
+++ b/admin/include/photos_add_direct_prepare.inc.php
@@ -55,17 +55,51 @@ if (isset($page['thumbnails']))
$uploadify_path = PHPWG_ROOT_PATH.'admin/include/uploadify';
+$upload_max_filesize = min(
+ get_ini_size('upload_max_filesize'),
+ get_ini_size('post_max_size')
+ );
+
+if ($upload_max_filesize == get_ini_size('upload_max_filesize'))
+{
+ $upload_max_filesize_shorthand = get_ini_size('upload_max_filesize', false);
+}
+else
+{
+ $upload_max_filesize_shorthand = get_ini_size('post_max_filesize', false);
+}
+
$template->assign(
array(
'F_ADD_ACTION'=> PHOTOS_ADD_BASE_URL,
'uploadify_path' => $uploadify_path,
- 'upload_max_filesize' => min(
- get_ini_size('upload_max_filesize'),
- get_ini_size('post_max_size')
- ),
+ 'upload_max_filesize' => $upload_max_filesize,
+ 'upload_max_filesize_shorthand' => $upload_max_filesize_shorthand,
)
);
+// what is the maximum number of pixels permitted by the memory_limit?
+if (pwg_image::get_library() == 'gd')
+{
+ $fudge_factor = 1.7;
+ $available_memory = get_ini_size('memory_limit') - memory_get_usage();
+ $max_upload_width = round(sqrt($available_memory/(2 * $fudge_factor)));
+ $max_upload_height = round(2 * $max_upload_width / 3);
+ $max_upload_resolution = floor($max_upload_width * $max_upload_height / (1024 * 1024));
+
+ // no need to display a limitation warning if the limitation is huge like 20MP
+ if ($max_upload_resolution < 25)
+ {
+ $template->assign(
+ array(
+ 'max_upload_width' => $max_upload_width,
+ 'max_upload_height' => $max_upload_height,
+ 'max_upload_resolution' => $max_upload_resolution,
+ )
+ );
+ }
+}
+
$upload_modes = array('html', 'multiple');
$upload_mode = isset($conf['upload_mode']) ? $conf['upload_mode'] : 'multiple';
@@ -92,6 +126,17 @@ $template->assign(
)
);
+$upload_file_types = 'jpeg, png, gif';
+if ('html' == $upload_mode)
+{
+ $upload_file_types.= ', zip';
+}
+$template->assign(
+ array(
+ 'upload_file_types' => $upload_file_types,
+ )
+ );
+
// +-----------------------------------------------------------------------+
// | Categories |
// +-----------------------------------------------------------------------+
diff --git a/admin/include/uploadify/uploadify.css b/admin/include/uploadify/uploadify.css
index 334837a95..9a94cb8eb 100644
--- a/admin/include/uploadify/uploadify.css
+++ b/admin/include/uploadify/uploadify.css
@@ -26,7 +26,6 @@ THE SOFTWARE.
width: 420px;
max-height: 300px;
overflow: auto;
- border: 1px solid #333;
margin: 0 auto 10px auto;
padding: 5px 0 10px 0;
}