Directly on the code
Plupload.addfilefilter (' Min_width ',function(maxwidth, file, CB) {varSelf = This, IMG =NewO.image (); functionFinalize (Result) {//CleanupImg.destroy (); IMG=NULL; //If rule has been violated in one-or another, trigger an error if(!result) {Self.trigger (' Error ', {code:plupload. Image_dimensions_error, message:"Picture width cannot be less than" + MaxWidth + "px", file:file}); } CB (Result); } img.onload=function () { //Check if resolution cap is not exceededFinalize (Img.width >=maxwidth); }; Img.onerror=function() {Finalize (false); }; Img.load (File.getsource ()); }); Plupload.addfilefilter (' FileType ',function(filetype, file, cb) {varSelf = This, IMG =NewO.image (); functionFinalize (Result) {//CleanupImg.destroy (); IMG=NULL; //If rule has been violated in one-or another, trigger an error if(!result) {Self.trigger (' Error ', {code:plupload. Image_dimensions_error, message:"The image format you uploaded is" + File.type + "and can only upload jpg images", file:file}); } CB (Result); } img.onload=function () { //Check if resolution cap is not exceeded varType =File.type; Type= Type.replace ("image/", "" "); Finalize (Filetype.indexof (type)> 0); }; Img.onerror=function() {Finalize (false); }; Img.load (File.getsource ()); }); varuploader =NewPlupload. Uploader ({//to create an instance construction methodBrowse_button: ' Fileinput-button ', runtimes:' Html5,flash,silverlight,html4 ',//Upload Plugin Initialize the order of precedence in that wayURL: "/common/imageup",//Remote Upload AddressMax_file_size: ' 20MB ', Chunk_size:' 500KB ', Filters: {title:"Image files", filetype: "Jpg,jpeg", min_width:600}, Flash_swf_url:'/scripts/plupload-2.1.9/moxie.swf ', }); Uploader.init ();
Reference article:
Http://stackoverflow.com/questions/14091505/control-image-width-and-height-when-upload-image
Plupload how to control the minimum width and file type