mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-19 16:13:00 +02:00
feature 2410 added: uploadify upgraded from version 2.1.0 to 3.0.0 (still beta,
but said as stable by users on uploadify forums) bug 2411 fixed: thanks to uploadify 3.0.0, the "Browse" button is now localized (text in any language) bug 1653 fixed: if the selected file exceeds the upload_max_size (as defined in the php.ini), an alert is shown and the file is not added to the queue. bug 2412 fixed: ability to select GIF files with the Flash Uploader. git-svn-id: http://piwigo.org/svn/trunk@11975 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -85,7 +85,12 @@ if (pwg_image::get_library() == 'gd')
|
||||
$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));
|
||||
|
||||
// we don't want dimensions like 2995x1992 but 3000x2000
|
||||
$max_upload_width = round($max_upload_width/100)*100;
|
||||
$max_upload_height = round($max_upload_height/100)*100;
|
||||
|
||||
$max_upload_resolution = floor($max_upload_width * $max_upload_height / (1000000));
|
||||
|
||||
// no need to display a limitation warning if the limitation is huge like 20MP
|
||||
if ($max_upload_resolution < 25)
|
||||
|
||||
@@ -42,9 +42,19 @@ if (isset($_GET['processed']))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$category_id = $_POST['category'];
|
||||
else
|
||||
{
|
||||
$category_id = $_POST['category'];
|
||||
}
|
||||
|
||||
if (isset($_POST['onUploadError']) and is_array($_POST['onUploadError']) and count($_POST['onUploadError']) > 0)
|
||||
{
|
||||
foreach ($_POST['onUploadError'] as $error)
|
||||
{
|
||||
array_push($page['errors'], $error);
|
||||
}
|
||||
}
|
||||
|
||||
$image_ids = array();
|
||||
|
||||
if (isset($_FILES) and !empty($_FILES['image_upload']))
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
Uploadify v2.1.0
|
||||
Release Date: August 24, 2009
|
||||
|
||||
Copyright (c) 2009 Ronnie Garcia, Travis Nickels
|
||||
Uploadify v3.0.0
|
||||
Copyright (c) 2010 Ronnie Garcia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +20,69 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
.uploadify {margin:0 auto 10px auto}
|
||||
|
||||
.uploadifyButton {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
color: #eeeeee;
|
||||
padding: 8px 0;
|
||||
text-align: center;
|
||||
height: 14px;
|
||||
width: 100%;
|
||||
background-color: #464646;
|
||||
-webkit-border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
border-radius:5px;
|
||||
letter-spacing:2px;
|
||||
}
|
||||
.uploadify:hover .uploadifyButton {
|
||||
color:#fff;
|
||||
background-color: #333;
|
||||
cursor:pointer;
|
||||
}
|
||||
.uploadifyQueueItem {
|
||||
background-color: #F5F5F5;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
font: 11px Verdana, Geneva, sans-serif;
|
||||
margin-top: 5px;
|
||||
max-width: 350px;
|
||||
padding: 10px;
|
||||
}
|
||||
.uploadifyQueueItem .cancel {
|
||||
float: right;
|
||||
}
|
||||
.uploadifyQueueItem .fileName, .uploadifyQueueItem .data {
|
||||
float: left;
|
||||
}
|
||||
.uploadifyQueue .completed {
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
.uploadifyProgress {
|
||||
background-color: #E5E5E5;
|
||||
margin-top: 25px;
|
||||
height: 3px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.uploadifyProgressBar {
|
||||
background-color: #0099FF;
|
||||
height: 3px;
|
||||
width: 1px;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
}
|
||||
.uploadifyError {
|
||||
background-color: #FDE5DD !important;
|
||||
}
|
||||
|
||||
|
||||
/* Piwigo specific */
|
||||
#fileQueue {
|
||||
width: 420px;
|
||||
max-height: 300px;
|
||||
@@ -49,7 +110,6 @@ THE SOFTWARE.
|
||||
.uploadifyProgress {
|
||||
background-color: #333;
|
||||
border: 1px solid #666;
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.uploadifyProgressBar {
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
// this file must be in UTF-8 format
|
||||
|
||||
var uploadifyLang = new Array();
|
||||
|
||||
uploadifyLang['buttonText'] = 'SELECT FILES';
|
||||
uploadifyLang['fileTypeDesc'] = 'All Files (*.*)';
|
||||
uploadifyLang['replaceMsg1'] = 'The file named';
|
||||
uploadifyLang['replaceMsg2'] = 'is already in the queue';
|
||||
uploadifyLang['replaceMsg3'] = 'Do you want to replace the existing item in the queue?';
|
||||
uploadifyLang['existsMsg1'] = 'A file with the name';
|
||||
uploadifyLang['existsMsg2'] = 'already exists on the server';
|
||||
uploadifyLang['existsMsg3'] = 'Would you like to replace the existing file?';
|
||||
uploadifyLang['errorMsg1'] = 'Some files were not added to the queue:';
|
||||
uploadifyLang['errorMsg2'] = 'The number of files selected exceeds the remaining upload limit';
|
||||
uploadifyLang['errorMsg3'] = 'The number of files selected exceeds the queue size limit';
|
||||
uploadifyLang['errorMsg4'] = 'The file';
|
||||
uploadifyLang['errorMsg5'] = 'exceeds the size limit';
|
||||
uploadifyLang['errorMsg6'] = 'is empty';
|
||||
uploadifyLang['errorMsg7'] = 'is not an accepted file type';
|
||||
uploadifyLang['errorString1'] = 'Error';
|
||||
uploadifyLang['errorString2'] = 'HTTP Error';
|
||||
uploadifyLang['errorString3'] = 'Missing Upload URL';
|
||||
uploadifyLang['errorString4'] = 'IO Error';
|
||||
uploadifyLang['errorString5'] = 'Security Error';
|
||||
uploadifyLang['errorString6'] = 'The upload limit has been reached';
|
||||
uploadifyLang['errorString7'] = 'Exceeds Upload Limit';
|
||||
uploadifyLang['errorString8'] = 'Failed';
|
||||
uploadifyLang['errorString9'] = 'File ID Not Found';
|
||||
uploadifyLang['errorString10'] = 'Validation Error';
|
||||
uploadifyLang['errorString11'] = 'Cancelled';
|
||||
uploadifyLang['errorString12'] = 'Stopped';
|
||||
uploadifyLang['uploadComplete'] = 'Complete';
|
||||
@@ -1,7 +1,6 @@
|
||||
{if $upload_mode eq 'multiple'}
|
||||
{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' }
|
||||
{combine_script id='swfobject' load='footer' path='admin/include/uploadify/swfobject.js'}
|
||||
{combine_script id='jquery.uploadify' load='footer' require='jquery' path='admin/include/uploadify/jquery.uploadify.v2.1.0.min.js' }
|
||||
{combine_script id='jquery.uploadify' load='footer' require='jquery' path='admin/include/uploadify/jquery.uploadify.v3.0.0.min.js' }
|
||||
{combine_css path="admin/themes/default/uploadify.jGrowl.css"}
|
||||
{combine_css path="admin/include/uploadify/uploadify.css"}
|
||||
{/if}
|
||||
@@ -176,116 +175,66 @@ var uploadify_path = '{$uploadify_path}';
|
||||
var upload_id = '{$upload_id}';
|
||||
var session_id = '{$session_id}';
|
||||
var pwg_token = '{$pwg_token}';
|
||||
var buttonText = 'Browse';
|
||||
var sizeLimit = {$upload_max_filesize};
|
||||
var buttonText = "{'Select files'|@translate}";
|
||||
var sizeLimit = Math.round({$upload_max_filesize} / 1024); /* in KBytes */
|
||||
|
||||
{literal}
|
||||
jQuery("#uploadify").uploadify({
|
||||
'uploader' : uploadify_path + '/uploadify.swf',
|
||||
'script' : uploadify_path + '/uploadify.php',
|
||||
'scriptData' : {
|
||||
'upload_id' : upload_id,
|
||||
'session_id' : session_id,
|
||||
'pwg_token' : pwg_token,
|
||||
},
|
||||
'cancelImg' : uploadify_path + '/cancel.png',
|
||||
'uploader' : uploadify_path + '/uploadify.php',
|
||||
'langFile' : uploadify_path + '/uploadifyLang_en.js',
|
||||
'swf' : uploadify_path + '/uploadify.swf',
|
||||
|
||||
buttonCursor : 'pointer',
|
||||
'buttonText' : buttonText,
|
||||
'width' : 300,
|
||||
'cancelImage' : uploadify_path + '/cancel.png',
|
||||
'queueID' : 'fileQueue',
|
||||
'auto' : false,
|
||||
'buttonText' : buttonText,
|
||||
'multi' : true,
|
||||
'fileDesc' : 'Photo files (*.jpg,*.jpeg,*.png)',
|
||||
'fileExt' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG',
|
||||
'sizeLimit' : sizeLimit,
|
||||
'fileTypeDesc' : 'Photo files',
|
||||
'fileTypeExts' : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.gif;*.GIF',
|
||||
'fileSizeLimit' : sizeLimit,
|
||||
'progressData' : 'percentage',
|
||||
requeueErrors : false,
|
||||
'onSelect' : function(event,ID,fileObj) {
|
||||
jQuery("#fileQueue").show();
|
||||
},
|
||||
'onAllComplete' : function(event, data) {
|
||||
if (data.errors) {
|
||||
'onQueueComplete' : function(stats) {
|
||||
jQuery("input[name=submit_upload]").click();
|
||||
},
|
||||
onUploadError: function (file,errorCode,errorMsg,errorString,swfuploadifyQueue) {
|
||||
/* uploadify calls the onUploadError trigger when the user cancels a file! */
|
||||
/* There no error so we skip it to avoid panic. */
|
||||
if ("Cancelled" == errorString) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
jQuery("input[name=submit_upload]").click();
|
||||
}
|
||||
},
|
||||
onError: function (event, queueID ,fileObj, errorObj) {
|
||||
var msg;
|
||||
|
||||
if (errorObj.type === "HTTP") {
|
||||
if (errorObj.info === 404) {
|
||||
alert('Could not find upload script.');
|
||||
msg = 'Could not find upload script.';
|
||||
}
|
||||
else {
|
||||
msg = errorObj.type+": "+errorObj.info;
|
||||
}
|
||||
}
|
||||
else if (errorObj.type ==="File Size") {
|
||||
msg = "File too big";
|
||||
msg = msg + '<br>'+fileObj.name+': '+humanReadableFileSize(fileObj.size);
|
||||
msg = msg + '<br>Limit: '+humanReadableFileSize(sizeLimit);
|
||||
}
|
||||
else {
|
||||
msg = errorObj.type+": "+errorObj.info;
|
||||
}
|
||||
var msg = file.name+', '+errorString;
|
||||
|
||||
/* Let's put the error message in the form to display once the form is */
|
||||
/* performed, it makes support easier when user can copy/paste the error */
|
||||
/* thrown. */
|
||||
jQuery("#uploadForm").append('<input type="hidden" name="onUploadError[]" value="'+msg+'">');
|
||||
|
||||
jQuery.jGrowl(
|
||||
'<p></p>'+msg,
|
||||
'<p></p>onUploadError '+msg,
|
||||
{
|
||||
theme: 'error',
|
||||
header: 'ERROR',
|
||||
sticky: true
|
||||
life: 4000,
|
||||
sticky: false
|
||||
}
|
||||
);
|
||||
|
||||
jQuery("#fileUploadgrowl" + queueID).fadeOut(
|
||||
250,
|
||||
function() {
|
||||
jQuery("#fileUploadgrowl" + queueID).remove()
|
||||
}
|
||||
);
|
||||
return false;
|
||||
},
|
||||
onCancel: function (a, b, c, d) {
|
||||
var msg = "Cancelled uploading: "+c.name;
|
||||
jQuery.jGrowl(
|
||||
'<p></p>'+msg,
|
||||
{
|
||||
theme: 'warning',
|
||||
header: 'Cancelled Upload',
|
||||
life: 4000,
|
||||
sticky: false
|
||||
}
|
||||
);
|
||||
},
|
||||
onClearQueue: function (a, b) {
|
||||
var msg = "Cleared "+b.fileCount+" files from queue";
|
||||
jQuery.jGrowl(
|
||||
'<p></p>'+msg,
|
||||
{
|
||||
theme: 'warning',
|
||||
header: 'Cleared Queue',
|
||||
life: 4000,
|
||||
sticky: false
|
||||
}
|
||||
);
|
||||
},
|
||||
onComplete: function (a, b ,c, response, e) {
|
||||
var size = Math.round(c.size/1024);
|
||||
|
||||
var response = jQuery.parseJSON(response);
|
||||
|
||||
onUploadSuccess: function (file,data,response) {
|
||||
var data = jQuery.parseJSON(data);
|
||||
jQuery("#uploadedPhotos").parent("fieldset").show();
|
||||
jQuery("#uploadedPhotos").prepend('<img src="'+response.thumbnail_url+'" class="thumbnail"> ');
|
||||
|
||||
jQuery.jGrowl(
|
||||
'<p></p>'+c.name+' - '+size+'KB',
|
||||
{
|
||||
theme: 'success',
|
||||
header: 'Upload Complete',
|
||||
life: 4000,
|
||||
sticky: false
|
||||
}
|
||||
);
|
||||
/* Let's display the thumbnail of the uploaded photo, no need to wait the */
|
||||
/* end of the queue */
|
||||
jQuery("#uploadedPhotos").prepend('<img src="'+data.thumbnail_url+'" class="thumbnail"> ');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -295,10 +244,13 @@ var sizeLimit = {$upload_max_filesize};
|
||||
}
|
||||
|
||||
jQuery("#uploadify").uploadifySettings(
|
||||
'scriptData',
|
||||
'postData',
|
||||
{
|
||||
'category_id' : jQuery("select[name=category] option:selected").val(),
|
||||
'level' : jQuery("select[name=level] option:selected").val(),
|
||||
'upload_id' : upload_id,
|
||||
'session_id' : session_id,
|
||||
'pwg_token' : pwg_token,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -412,10 +364,7 @@ var sizeLimit = {$upload_max_filesize};
|
||||
<p id="uploadModeInfos">{'You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'|@translate|@sprintf:$switch_url}</p>
|
||||
|
||||
{elseif $upload_mode eq 'multiple'}
|
||||
|
||||
<p>
|
||||
<input type="file" name="uploadify" id="uploadify">
|
||||
</p>
|
||||
<div id="uploadify">You've got a problem with your JavaScript</div>
|
||||
|
||||
<div id="fileQueue" style="display:none"></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user