jpegアップロードにpluploadを使用するのに問題があります。それは私の最初の画像の向きを保存せず、毎回横向きに設定します。
私もpngを試してみましたが、この場合は問題なく動作します。
これが私のコードです:
$files = new Array();
//return number of file authorized for selected city
$.ajax({
type: "GET",
//dataType: "jsonp",
cache: false,
url: "/fileauthorized",
data: {
cityid : $cityid
},
success: function(data) {
$nbfile = data;
$nbfileauthorized = 5 - $nbfile;
uploader = new plupload.Uploader({
runtimes : 'html5,flash',
browse_button : 'pickfiles',
container : 'container',
max_file_size : '10mb',
chunk_size : '1mb',
url : '/addphototemptorep',
flash_swf_url : '/plupload/js/plupload.flash.swf',
unique_names : true,
filters : [
{
title : "Image files",
extensions : "jpg,gif,png"
}
],
resize : {
width : 700,
height : 700,
quality : 100
},
init : {
StateChanged: function(up) {
// Called when the state of the queue is changed
if(plupload.STOPPED){
}
}
}
});
$('#uploadfiles').click(function(e) {
$countfile = $('#filelist li').size();
if($countfile > $nbfileauthorized){
alert("vous avez depassé la limite de fichiers autorisé : " + $countfile + " / " + $nbfileauthorized);
}else{
uploader.start();
}
e.preventDefault();
});
uploader.init();
uploader.bind('FilesAdded', function(up, files) {
$.each(files, function(i, file) {
$('#filelist').append(
'<li class="clearfix plupload_delete" id="' + file.id + '">' +
"<div class='filename'>" + file.name + '</div><div class="filesize">' + plupload.formatSize(file.size) + '</div><div class="filestatus"></div>' +
'<div class="deletefile"><a id="deletefile" class="tooltip" title="supprimer la photo" href="#"><i class="icon-remove"></i></a></div></li>');
});
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('UploadProgress', function(up, file) {
$('#' + file.id).find('.filestatus').html(file.percent + "%");
});
uploader.bind('Error', function(up, err) {
$('#filelist').append("<li class='clearfix'>Error: " + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
"</li>"
);
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('FileUploaded', function(up, file) {
$('#' + file.id).find('#deletefile').replaceWith("<i class='icon-ok'></i>");
});
uploader.bind('UploadComplete', function(up, files) {
i = 0;
for(var file in files){
$files.push(files[i].target_name);
i++;
}
$.ajax({
type: "GET",
dataType: "html",
cache: false,
data: {
files : $files,
cityid : $cityid
},
url: "/addphototemptodb",
success: function($photoid) {
$("#loader").hide();
if($photoid > 0){
openpopinedit($photoid, "newphoto");
}
}
});
});
}
});
}