aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/photos_add_direct_prepare.inc.php53
-rw-r--r--admin/include/uploadify/uploadify.css1
-rw-r--r--admin/themes/default/template/photos_add_direct.tpl31
-rw-r--r--admin/themes/default/theme.css13
4 files changed, 85 insertions, 13 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;
}
diff --git a/admin/themes/default/template/photos_add_direct.tpl b/admin/themes/default/template/photos_add_direct.tpl
index 7f17663f8..9ee4a8595 100644
--- a/admin/themes/default/template/photos_add_direct.tpl
+++ b/admin/themes/default/template/photos_add_direct.tpl
@@ -142,6 +142,11 @@ jQuery(document).ready(function(){
return false;
});
+ jQuery("#uploadWarningsSummary a.showInfo").click(function() {
+ jQuery("#uploadWarningsSummary").hide();
+ jQuery("#uploadWarnings").show();
+ });
+
{/literal}
{if $upload_mode eq 'html'}
{literal}
@@ -186,6 +191,9 @@ var sizeLimit = {$upload_max_filesize};
'fileDesc' : 'Photo files (*.jpg,*.jpeg,*.png)',
'fileExt' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG',
'sizeLimit' : sizeLimit,
+ 'onSelect' : function(event,ID,fileObj) {
+ jQuery("#fileQueue").show();
+ },
'onAllComplete' : function(event, data) {
if (data.errors) {
return false;
@@ -337,7 +345,7 @@ var sizeLimit = {$upload_max_filesize};
</div>
<p id="batchLink"><a href="{$batch_link}">{$batch_label}</a></p>
</fieldset>
-<p><a href="{$another_upload_link}">{'Add another set of photos'|@translate}</a></p>
+<p style="margin:10px"><a href="{$another_upload_link}">{'Add another set of photos'|@translate}</a></p>
{else}
<div id="formErrors" class="errors" style="display:none">
@@ -388,29 +396,38 @@ var sizeLimit = {$upload_max_filesize};
<fieldset>
<legend>{'Select files'|@translate}</legend>
-{if $upload_mode eq 'html'}
- <p><a href="{$switch_url}">{'... or switch to the multiple files form'|@translate}</a></p>
+ <p id="uploadWarningsSummary">{$upload_max_filesize_shorthand}B. {$upload_file_types}. {if isset($max_upload_resolution)}{$max_upload_resolution}Mpx{/if} <a class="showInfo" title="{'Learn more'|@translate}">i</a></p>
- <p>{'JPEG files or ZIP archives with JPEG files inside please.'|@translate}</p>
+ <p id="uploadWarnings">
+{'Maximum file size: %sB.'|@translate|@sprintf:$upload_max_filesize_shorthand}
+{'Allowed file types: %s.'|@translate|@sprintf:$upload_file_types}
+ {if isset($max_upload_resolution)}
+{'Approximate maximum resolution: %dM pixels (that\'s %dx%d pixels).'|@translate|@sprintf:$max_upload_resolution:$max_upload_width:$max_upload_height}
+ {/if}
+ </p>
+{if $upload_mode eq 'html'}
<div id="uploadBoxes"></div>
<div id="addUploadBox">
<a href="javascript:">{'+ Add an upload box'|@translate}</a>
</div>
+
+ <p id="uploadModeInfos">{'You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'|@translate|@sprintf:$switch_url}</p>
</fieldset>
<p>
- <input class="submit" type="submit" name="submit_upload" value="{'Upload'|@translate}">
+ <input class="submit" type="submit" name="submit_upload" value="{'Start Upload'|@translate}">
</p>
{elseif $upload_mode eq 'multiple'}
+
<p>
<input type="file" name="uploadify" id="uploadify">
</p>
- <p><a href="{$switch_url}">{'... or switch to the old style form'|@translate}</a></p>
+ <div id="fileQueue" style="display:none"></div>
- <div id="fileQueue"></div>
+ <p id="uploadModeInfos">{'You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'|@translate|@sprintf:$switch_url}</p>
</fieldset>
<p>
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index ad99e20ce..ff99ff8f7 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -922,6 +922,7 @@ h2:lang(en) { text-transform:capitalize; }
.pluginActions {display: table-row; font-size:0.95em; color:#777;}
.pluginActions DIV {display: table-cell; vertical-align: middle; line-height:18px; }
.showInfo {display:block;position:absolute;top:0;right:5px;width:15px;font-style:italic;font-family:"Georgia",serif;background-color:#464646;font-size:0.9em;border-radius:10px;-moz-border-radius:10px;}
+.showInfo:hover {cursor:pointer}
.warning:before {content:url(icon/warning.png);vertical-align:top;}
.deactivate_all {text-align:right;font-size:0.95em;}
@@ -1058,4 +1059,14 @@ div.token-input-dropdown ul li.token-input-selected-dropdown-item {background-co
#mainConfCheck span.property span.filter:first-child a.removeFilter {display:none;} /* can't delete the first field */
#mainConfCheck span.filter {display:block;margin-left:20px;}
#mainConfCheck .transparent {opacity:0.5;filter:alpha(opacity=50);}
-#mainConfCheck .order_by_is_custom {display:block;font-weight:normal;font-style:italic;margin-left:20px;} \ No newline at end of file
+#mainConfCheck .order_by_is_custom {display:block;font-weight:normal;font-style:italic;margin-left:20px;}
+
+/* Upload Form */
+#uploadBoxes .file {margin-bottom:5px;text-align:left;}
+#uploadBoxes {margin-top:20px;}
+#addUploadBox {margin-bottom:2em;}
+
+p#uploadWarningsSummary {text-align:left;margin-bottom:1em;font-size:90%;color:#999;}
+p#uploadWarningsSummary .showInfo {position:static;display:inline;padding:1px 6px;margin-left:3px;}
+p#uploadWarnings {display:none;text-align:left;margin-bottom:1em;font-size:90%;color:#999;}
+p#uploadModeInfos {text-align:left;margin-top:1em;font-size:90%;color:#999;} \ No newline at end of file