From 78525d4667bcad993393b92802079aaf9ac72450 Mon Sep 17 00:00:00 2001 From: xiaoz Date: Fri, 22 Dec 2017 19:36:16 +0800 Subject: [PATCH] add --- config.php | 6 ++ index.html | 94 ++++++++++++++++++++ static/ajax-load.gif | Bin 0 -> 24332 bytes static/embed.js | 46 ++++++++++ static/jquery.uploadfile.min.js | 8 ++ static/style.css | 74 ++++++++++++++++ static/uploadfile.css | 146 ++++++++++++++++++++++++++++++++ upload.php | 103 ++++++++++++++++++++++ 8 files changed, 477 insertions(+) create mode 100644 config.php create mode 100644 index.html create mode 100644 static/ajax-load.gif create mode 100644 static/embed.js create mode 100644 static/jquery.uploadfile.min.js create mode 100644 static/style.css create mode 100644 static/uploadfile.css create mode 100644 upload.php diff --git a/config.php b/config.php new file mode 100644 index 0000000..e304888 --- /dev/null +++ b/config.php @@ -0,0 +1,6 @@ + 'http://localhost/imgurl/', + 'watermark' => 'false' + ); +?> \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..2ebc4fa --- /dev/null +++ b/index.html @@ -0,0 +1,94 @@ + + + + + newindex + + + + + + + + + + + + + +
+
复制成功!
+
+
+ + + +
+
+
+
Upload
+ + + + +
+
+
+ + + + diff --git a/static/ajax-load.gif b/static/ajax-load.gif new file mode 100644 index 0000000000000000000000000000000000000000..215e240dd56e7f12b2ea1f2ff19dd95d50cf8da6 GIT binary patch literal 24332 zcmeI42UJvPw(l#GgXAP4A|M$=vREieMhqB8(t_k9AW@+J6(xy^A{oh{$QcSKa?VH& zMUYhFoGjnz<~`qCJ-4}cddy1Kfirlz*Gwyv(Oo?nhHU%vGB z_YV#Zj*X4Y&(AL}FR!hwZES38ZEbCDZ}05v?CnBf7b$F@#*hmnpbb%x}u5dr}tnWQsA=y@B#Yy*91gN0JV^? zDQCx4`4H3c={075uJNTlqZ+B46IbWYblzg5F( zjG7}=@{-yjq#PDTn(~r6Vvs(hCsp%Py5g1J^XWI|r}iXk#j8fC7NmVizn5n*+FX#{ zpJiC%c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?aI;jWeM!=pf{k$RElu34?nZXHlO`kflcU5gz)B!@Kq@V7|rT) zo&3|#oMdUoOd8+r%~Kb&UrUJAzlm5OSQ%30q_(pzY&a}0CQF4jaX<{o!R700FbN{% zaS8zk+IuOZL3bs1Jo2n7bQ7=6OLQ^Hba}qX8(l*bYMk-QkMr+|5SR6n0xWVGWN^d3-sSH#4Pxq3fz94dm;OO0M8Z`&;S4c literal 0 HcmV?d00001 diff --git a/static/embed.js b/static/embed.js new file mode 100644 index 0000000..eac4576 --- /dev/null +++ b/static/embed.js @@ -0,0 +1,46 @@ +$(document).ready(function() +{ + $("#fileuploader").uploadFile({ + url:"./upload.php", + maxFileSize:"2097152", + allowedTypes:"jpg,png,gif,bmp", + showStatusAfterSuccess:"false", + dragdropWidth:"100%", + + + //允许上传最大文件数量 + //showDone:"false" + //showQueueDiv: "output" + onSubmit:function(files) + { + $("#loading").show(); + }, + onSuccess:function(files,data,xhr,pd) + { + $("#loading").hide(); + $("#relink").show(); + var imginfo = new Function("return" + data)(); + document.getElementById("linkurl").value = imginfo.linkurl; + document.getElementById("htmlurl").value = ""; + document.getElementById("mdurl").value = "![](" + imginfo.linkurl + ")"; + document.getElementById("bbcode").value = "[img]" + imginfo.linkurl + "[/img]"; + $("#show_img").attr('src',imginfo.linkurl); + $("#img-url").attr('href',imginfo.linkurl); + $("#img-box").show(); + } + }); +}); + +//复制按钮 +function copy(url) { + + new clipBoard($("#url"),{ + copy: function() { + return $("#" + url).val(); + }, + afterCopy: function() { + $("#msg").show(); + $("#msg").fadeOut(1500); + } + }); +} \ No newline at end of file diff --git a/static/jquery.uploadfile.min.js b/static/jquery.uploadfile.min.js new file mode 100644 index 0000000..a9e71f5 --- /dev/null +++ b/static/jquery.uploadfile.min.js @@ -0,0 +1,8 @@ +/*! + * jQuery Upload File Plugin + * version: 4.0.11 + * @requires jQuery v1.5 or later & form plugin + * Copyright (c) 2013 Ravishanker Kusuma + * http://hayageek.com/ + */ +!function(e){void 0==e.fn.ajaxForm&&e.getScript(("https:"==document.location.protocol?"https://":"http://")+"cdn.bootcss.com/jquery.form/3.51/jquery.form.min.js");var a={};a.fileapi=void 0!==e("").get(0).files,a.formdata=void 0!==window.FormData,e.fn.uploadFile=function(t){function r(){D||(D=!0,function e(){if(w.sequential||(w.sequentialCount=99999),0==x.length&&0==F.length)w.afterUploadAll&&w.afterUploadAll(C),D=!1;else{if(F.length1?t.showError&&e("
"+t.multiDragErrorStr+"
").appendTo(a.errorLog):0!=t.onSelect(o)&&l(t,a,o)}),r.on("dragleave",function(a){e(this).removeClass(t.dragDropHoverClass)}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(a){a.stopPropagation(),a.preventDefault();var r=e(this);r.hasClass(t.dragDropContainerClass)||r.removeClass(t.dragDropHoverClass)}),e(document).on("drop",function(a){a.stopPropagation(),a.preventDefault(),e(this).removeClass(t.dragDropHoverClass)})}function s(e){var a=e/1024;return parseInt(a)>1024?(a/1024).toFixed(2)+" MB":a.toFixed(2)+" KB"}function i(a){var t,r,o=[],s=(o="string"==jQuery.type(a)?a.split("&"):e.param(a).split("&")).length,i=[];for(t=0;ta.maxFileSize)a.showError&&e("
"+r[o].name+" "+a.sizeErrorStr+s(a.maxFileSize)+"
").appendTo(t.errorLog);else if(-1!=a.maxFileCount&&t.selectedFiles>=a.maxFileCount)a.showError&&e("
"+r[o].name+" "+a.maxFileCountErrorStr+a.maxFileCount+"
").appendTo(t.errorLog);else{t.selectedFiles++,t.existingFileNames.push(r[o].name);var l=e.extend({},a),u=new FormData,p=a.fileName.replace("[]","");u.append(p,r[o]);var c=a.formData;if(c)for(var h=i(c),f=0;f");C.appendTo("body");var b=[];b.push(r[o].name),v(C,l,w,b,t,r[o]),t.fileCounter++}else a.showError&&e("
"+r[o].name+" "+a.duplicateErrorStr+"
").appendTo(t.errorLog);else a.showError&&e("
"+r[o].name+" "+a.extErrorStr+a.allowedTypes+"
").appendTo(t.errorLog)}function n(e,a,t){var r=a.allowedTypes.toLowerCase().split(/[\s,]+/g),o=t.split(".").pop().toLowerCase();return!("*"!=a.allowedTypes&&jQuery.inArray(o,r)<0)}function d(e,a){var t=!1;if(e.existingFileNames.length)for(var r=0;r"),u="";o.multiple&&(o.fileName.indexOf("[]")!=o.fileName.length-2&&(o.fileName+="[]"),u="");var p=e(u).appendTo(d);p.change(function(){t.errorLog.html("");o.allowedTypes.toLowerCase().split(",");var i=[];if(this.files){for(g=0;g"+u+" "+o.extErrorStr+o.allowedTypes+"").appendTo(t.errorLog));if(p.push({name:u,size:"NA"}),0==o.onSelect(p))return}if(c(o,t),s.unbind("click"),d.hide(),h(t,r,o,s),d.addClass(r),o.serialize&&a.fileapi&&a.formdata){d.removeClass(r);var f=this.files;d.remove(),l(o,t,f)}else{for(var w="",g=0;g":w+=i[g]+"
",t.fileCounter++;if(-1!=o.maxFileCount&&t.selectedFiles+i.length>o.maxFileCount)return void(o.showError&&e("
"+w+" "+o.maxFileCountErrorStr+o.maxFileCount+"
").appendTo(t.errorLog));t.selectedFiles+=i.length;var C=new m(t,o);C.filename.html(w),v(d,o,C,i,t,null)}}),o.nestedForms?(d.css({margin:0,padding:0}),s.css({position:"relative",overflow:"hidden",cursor:"default"}),p.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"100%",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),d.appendTo(s)):(d.appendTo(e("body")),d.css({margin:0,padding:0,display:"block",position:"absolute",left:"-250px"}),-1!=navigator.appVersion.indexOf("MSIE ")?s.attr("for",i):s.click(function(){p.click()}))}function f(a,t){return this.statusbar=e("
").width(t.statusBarWidth),this.preview=e("").width(t.previewWidth).height(t.previewHeight).appendTo(this.statusbar).hide(),this.filename=e("
").appendTo(this.statusbar),this.progressDiv=e("
").appendTo(this.statusbar).hide(),this.progressbar=e("
").appendTo(this.progressDiv),this.abort=e("
"+t.abortStr+"
").appendTo(this.statusbar).hide(),this.cancel=e("
"+t.cancelStr+"
").appendTo(this.statusbar).hide(),this.done=e("
"+t.doneStr+"
").appendTo(this.statusbar).hide(),this.download=e("
"+t.downloadStr+"
").appendTo(this.statusbar).hide(),this.del=e("
"+t.deleteStr+"
").appendTo(this.statusbar).hide(),this.abort.addClass("ajax-file-upload-red"),this.done.addClass("ajax-file-upload-green"),this.download.addClass("ajax-file-upload-green"),this.cancel.addClass("ajax-file-upload-red"),this.del.addClass("ajax-file-upload-red"),this}function m(a,t){var r=null;return(r=t.customProgressBar?new t.customProgressBar(a,t):new f(a,t)).abort.addClass(a.formGroup),r.abort.addClass(t.abortButtonClass),r.cancel.addClass(a.formGroup),r.cancel.addClass(t.cancelButtonClass),t.extraHTML&&(r.extraHTML=e("
"+t.extraHTML()+"
").insertAfter(r.filename)),"bottom"==t.uploadQueueOrder?e(a.container).append(r.statusbar):e(a.container).prepend(r.statusbar),r}function v(t,o,s,l,n,d){var h={cache:!1,contentType:!1,processData:!1,forceSync:!1,type:o.method,data:o.formData,formData:o.fileData,dataType:o.returnType,headers:o.headers,beforeSubmit:function(a,r,d){if(0!=o.onSubmit.call(this,l)){if(o.dynamicFormData){var p=i(o.dynamicFormData());if(p)for(var h=0;h"+o.uploadErrorStr+"
"),s.cancel.show(),t.remove(),s.cancel.click(function(){x.splice(x.indexOf(t),1),u(n,l),s.statusbar.remove(),o.onCancel.call(n,l,s),n.selectedFiles-=l.length,c(o,n)}),!1},beforeSend:function(e,t){for(var r in t.headers)e.setRequestHeader(r,t.headers[r]);s.progressDiv.show(),s.cancel.hide(),s.done.hide(),o.showAbort&&(s.abort.show(),s.abort.click(function(){u(n,l),e.abort(),n.selectedFiles-=l.length,o.onAbort.call(n,l,s)})),a.formdata?s.progressbar.width("1%"):s.progressbar.width("5%")},uploadProgress:function(e,a,t,r){r>98&&(r=98);var i=r+"%";r>1&&s.progressbar.width(i),o.showProgress&&(s.progressbar.html(i),s.progressbar.css("text-align","center"))},success:function(a,r,i){if(s.cancel.remove(),F.pop(),"json"==o.returnType&&"object"==e.type(a)&&a.hasOwnProperty(o.customErrorKeyStr)){s.abort.hide();var d=a[o.customErrorKeyStr];return o.onError.call(this,l,200,d,s),o.showStatusAfterError?(s.progressDiv.hide(),s.statusbar.append("ERROR: "+d+"")):(s.statusbar.hide(),s.statusbar.remove()),n.selectedFiles-=l.length,void t.remove()}n.responses.push(a),s.progressbar.width("100%"),o.showProgress&&(s.progressbar.html("100%"),s.progressbar.css("text-align","center")),s.abort.hide(),o.onSuccess.call(this,l,a,i,s),o.showStatusAfterSuccess?(o.showDone?(s.done.show(),s.done.click(function(){s.statusbar.hide("slow"),s.statusbar.remove()})):s.done.hide(),o.showDelete?(s.del.show(),s.del.click(function(){u(n,l),s.statusbar.hide().remove(),o.deleteCallback&&o.deleteCallback.call(this,a,s),n.selectedFiles-=l.length,c(o,n)})):s.del.hide()):(s.statusbar.hide("slow"),s.statusbar.remove()),o.showDownload&&(s.download.show(),s.download.click(function(){o.downloadCallback&&o.downloadCallback(a,s)})),t.remove()},error:function(e,a,r){s.cancel.remove(),F.pop(),s.abort.hide(),"abort"==e.statusText?(s.statusbar.hide("slow").remove(),c(o,n)):(o.onError.call(this,l,a,r,s),o.showStatusAfterError?(s.progressDiv.hide(),s.statusbar.append("ERROR: "+r+"")):(s.statusbar.hide(),s.statusbar.remove()),n.selectedFiles-=l.length),t.remove()}};o.showPreview&&null!=d&&"image"==d.type.toLowerCase().split("/").shift()&&p(d,s.preview),o.autoSubmit?(t.ajaxForm(h),x.push(t),r()):(o.showCancel&&(s.cancel.show(),s.cancel.click(function(){x.splice(x.indexOf(t),1),u(n,l),t.remove(),s.statusbar.remove(),o.onCancel.call(n,l,s),n.selectedFiles-=l.length,c(o,n)})),t.ajaxForm(h))}var w=e.extend({url:"",method:"POST",enctype:"multipart/form-data",returnType:null,allowDuplicates:!0,duplicateStrict:!1,allowedTypes:"*",acceptFiles:"*",fileName:"file",formData:!1,dynamicFormData:!1,maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!1,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showFileSize:!0,showProgress:!1,nestedForms:!0,showDownload:!1,onLoad:function(e){},onSelect:function(e){return!0},onSubmit:function(e,a){},onSuccess:function(e,a,t,r){},onError:function(e,a,t,r){},onCancel:function(e,a){},onAbort:function(e,a){},downloadCallback:!1,deleteCallback:!1,afterUploadAll:!1,serialize:!0,sequential:!1,sequentialCount:2,customProgressBar:!1,abortButtonClass:"ajax-file-upload-abort",cancelButtonClass:"ajax-file-upload-cancel",dragDropContainerClass:"ajax-upload-dragdrop",dragDropHoverClass:"state-hover",errorClass:"ajax-file-upload-error",uploadButtonClass:"ajax-file-upload",dragDropStr:"Drag & Drop Files",uploadStr:"Upload",abortStr:"Abort",cancelStr:"Cancel",deleteStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag & Drop is not allowed.",extErrorStr:"is not allowed. Allowed extensions: ",duplicateErrorStr:"is not allowed. File already exists.",sizeErrorStr:"is not allowed. Allowed Max size: ",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:" is not allowed. Maximum allowed files are:",downloadStr:"Download",customErrorKeyStr:"jquery-upload-file-error",showQueueDiv:!1,statusBarWidth:400,dragdropWidth:400,showPreview:!1,previewHeight:"auto",previewWidth:"100%",extraHTML:!1,uploadQueueOrder:"top",headers:{}},t);this.fileCounter=1,this.selectedFiles=0;var g="ajax-file-upload-"+(new Date).getTime();this.formGroup=g,this.errorLog=e("
"),this.responses=[],this.existingFileNames=[],a.formdata||(w.dragDrop=!1),a.formdata&&1!==w.maxFileCount||(w.multiple=!1),e(this).html("");var C=this,b=e("
"+w.uploadStr+"
");e(b).addClass(w.uploadButtonClass),function a(){if(e.fn.ajaxForm){if(w.dragDrop){var t=e('
').width(w.dragdropWidth);e(C).append(t),e(t).append(b),e(t).append(e(w.dragDropStr)),o(C,w,t)}else e(C).append(b);e(C).append(C.errorLog),w.showQueueDiv?C.container=e("#"+w.showQueueDiv):C.container=e("
").insertAfter(e(C)),w.onLoad.call(this,C),h(C,g,w,b)}else window.setTimeout(a,10)}(),this.startUpload=function(){e("form").each(function(a,t){e(this).hasClass(C.formGroup)&&x.push(e(this))}),x.length>=1&&r()},this.getFileCount=function(){return C.selectedFiles},this.stopUpload=function(){e("."+w.abortButtonClass).each(function(a,t){e(this).hasClass(C.formGroup)&&e(this).click()}),e("."+w.cancelButtonClass).each(function(a,t){e(this).hasClass(C.formGroup)&&e(this).click()})},this.cancelAll=function(){e("."+w.cancelButtonClass).each(function(a,t){e(this).hasClass(C.formGroup)&&e(this).click()})},this.update=function(a){w=e.extend(w,a),a.hasOwnProperty("url")&&e("form").each(function(t,r){e(this).attr("action",a.url)})},this.enqueueFile=function(e){e instanceof File&&l(w,C,[e])},this.reset=function(e){C.fileCounter=1,C.selectedFiles=0,C.errorLog.html(""),0!=e&&C.container.html("")},this.remove=function(){C.container.html(""),e(C).remove()},this.createProgress=function(e,a,t){var r=new m(this,w);r.progressDiv.show(),r.progressbar.width("100%");var o="";return o=w.showFileCounter?C.fileCounter+w.fileCounterStyle+e:e,w.showFileSize&&(o+=" ("+s(t)+")"),r.filename.html(o),C.fileCounter++,C.selectedFiles++,w.showPreview&&(r.preview.attr("src",a),r.preview.show()),w.showDownload&&(r.download.show(),r.download.click(function(){w.downloadCallback&&w.downloadCallback.call(C,[e],r)})),w.showDelete&&(r.del.show(),r.del.click(function(){r.statusbar.hide().remove();var a=[e];w.deleteCallback&&w.deleteCallback.call(this,a,r),C.selectedFiles-=1,c(w,C)})),r},this.getResponses=function(){return this.responses};var x=[],F=[],D=!1;return this}}(jQuery); \ No newline at end of file diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..ce5170a --- /dev/null +++ b/static/style.css @@ -0,0 +1,74 @@ +.ajax-file-upload-container { + display: none; +} + +#fileuploader { + width:100%; +} +.ajax-upload-dragdrop { + height:200px; +} +.ajax-file-upload { + margin-left:auto; + margin-right:auto; +} + +#loading{ + margin:0; + padding:0; + display:none; + width:100%; + position:fixed; +} +#fileuploader { + margin-top:10%; +} +#relink{ + display: none; + margin-top:36px; +} +#relink lable{ + color:#2BD5AA; + padding:10px; +} +#msg{ + margin:0; + padding:0; + width:100%; + position:fixed; + display: none; + z-index: 100; + top:60px; +} +.msg{ + color:green; + border:1px solid #EFEFEF; + background-color:#E6E6E6; + text-align:center; + padding:12px; + border-radius:5px; + width:16%; + margin:auto; + font-size:16px; +} +#img-box{ + margin-bottom:20px; +} +#menu{ + margin:0; + padding:0; + width:100%; + background-color:#222222; +} +#menu .navbar { + margin-bottom:0; +} + +#footer{ + width:100%; + background-color: #F5F5F5; + color:#999999; + position:fixed; + bottom:0; + padding:14px; +} \ No newline at end of file diff --git a/static/uploadfile.css b/static/uploadfile.css new file mode 100644 index 0000000..e22bafb --- /dev/null +++ b/static/uploadfile.css @@ -0,0 +1,146 @@ +.ajax-file-upload-statusbar { +border: 1px solid #0ba1b5; +margin-top: 10px; +width: 420px; +margin-right: 10px; +margin: 5px; +-moz-border-radius: 4px; +-webkit-border-radius: 4px; +border-radius: 4px; +padding: 5px 5px 5px 15px +} + +.ajax-file-upload-filename { +width: 300px; +height: auto; +margin: 0 5px 5px 0px; + +} + +.ajax-file-upload-filesize { +width: 50px; +height: auto; +margin: 0 5px 5px 0px; +display: inline-block; +vertical-align:middle; +} +.ajax-file-upload-progress { +margin: 5px 10px 5px 0px; +position: relative; +width: 250px; +border: 1px solid #ddd; +padding: 1px; +border-radius: 3px; +display: inline-block; +color:#FFFFFF; + +} +.ajax-file-upload-bar { +background-color: #0ba1b5; +width: 0; +height: 20px; +border-radius: 3px; +color:#FFFFFF; + +} +.ajax-file-upload-percent { +position: absolute; +display: inline-block; +top: 3px; +left: 48% +} +.ajax-file-upload-red { +-moz-box-shadow: inset 0 39px 0 -24px #e67a73; +-webkit-box-shadow: inset 0 39px 0 -24px #e67a73; +box-shadow: inset 0 39px 0 -24px #e67a73; +background-color: #e4685d; +-moz-border-radius: 4px; +-webkit-border-radius: 4px; +border-radius: 4px; +display: inline-block; +color: #fff; +font-family: arial; +font-size: 13px; +font-weight: normal; +padding: 4px 15px; +text-decoration: none; +text-shadow: 0 1px 0 #b23e35; +cursor: pointer; +vertical-align: top; +margin: 5px 10px 5px 0px; +} +.ajax-file-upload-green { +background-color: #77b55a; +-moz-border-radius: 4px; +-webkit-border-radius: 4px; +border-radius: 4px; +margin: 0; +padding: 0; +display: inline-block; +color: #fff; +font-family: arial; +font-size: 13px; +font-weight: normal; +padding: 4px 15px; +text-decoration: none; +cursor: pointer; +text-shadow: 0 1px 0 #5b8a3c; +vertical-align: top; +margin: 5px 10px 5px 0px; +} +.ajax-file-upload { + font-family: Arial, Helvetica, sans-serif; + font-size: 16px; + font-weight: bold; + padding: 15px 20px; + cursor:pointer; + line-height:20px; + height:25px; + margin:0 10px 10px 0; + display: inline-block; + background: #fff; + border: 1px solid #e8e8e8; + color: #888; + text-decoration: none; + border-radius: 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -moz-box-shadow: 0 2px 0 0 #e8e8e8; + -webkit-box-shadow: 0 2px 0 0 #e8e8e8; + box-shadow: 0 2px 0 0 #e8e8e8; + padding: 6px 10px 4px 10px; + color: #fff; + background: #2f8ab9; + border: none; + -moz-box-shadow: 0 2px 0 0 #13648d; + -webkit-box-shadow: 0 2px 0 0 #13648d; + box-shadow: 0 2px 0 0 #13648d; + vertical-align: middle; + } + +.ajax-file-upload:hover { + background: #3396c9; + -moz-box-shadow: 0 2px 0 0 #15719f; + -webkit-box-shadow: 0 2px 0 0 #15719f; + box-shadow: 0 2px 0 0 #15719f; +} + +.ajax-upload-dragdrop +{ + + border:2px dotted #A5A5C7; + width:420px; + color: #DADCE3; + text-align:left; + vertical-align:middle; + padding:10px 10px 0px 10px; +} + +.state-hover +{ + border:2px solid #A5A5C7; +} +.ajax-file-upload-container +{ + margin:20px 0px 20px 0px; +} \ No newline at end of file diff --git a/upload.php b/upload.php new file mode 100644 index 0000000..9b479fd --- /dev/null +++ b/upload.php @@ -0,0 +1,103 @@ + 0) + { + echo "Return Code: " . $_FILES["file"]["error"] . "
"; + } + else { + //如果上传成功 + if(move_uploaded_file($img_tmp,$dir_name)){ + //设置自己的TinyPNG API KEY + // Tinify\setKey("TinyPNG API KEY"); + //Tinify\fromFile($dir_name)->toFile($dir_name); + //请在下面设置您自己的域名 + $img_url = $config['domain'].$dir_name; //自定义图片路径 + $img_info = getimagesize($dir_name); + $img_width = $img_info['0']; //图片宽度 + $img_height = $img_info['1']; //图片高度 + $re_data = array("linkurl" => $img_url,width => $img_width,"height" => $img_height,"status" => 'ok'); + //返回json格式 + echo json_encode($re_data); + } + //没有上传成功 + else{ + echo md5("360baidu103.jpg"); + } + } + } + else{ + $re_data = array("linkurl" => $img_url,width => $img_width,"height" => $img_height,"status" => 'no'); + //返回json格式 + echo json_encode($re_data); + } +?> \ No newline at end of file