You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
1.4 KiB
2 lines
1.4 KiB
"use strict";const d=require("../store/index.js"),b=require("../config/index.js"),l=(i="",e="")=>i?i.indexOf("http")===0?i:(e===""&&(e=d.$store("app").info.cdnurl),e+i):"",g={cdn:l,thumb:(i="",e)=>(i=l(i),u(i,e)),static:(i="",e="")=>(e===""&&(e=b.staticUrl),e!=="local"&&(i=l(i,e)),i),css:(i="",e="")=>(e===""&&(e=b.staticUrl),e!=="local"&&(i=l(i,e)),`url(${i})`)};function u(i,e){const m=d.$store("app").info.filesystem;if(m==="public")return i;let o=e.width||"200",h=e.height||"200",s=e.mode||"lfit",r=e.quality||90,a=e.gravity||"center",n="",f="",c="",t=o+"x"+h;switch(m){case"aliyun":!a&&a!="center"&&(s="mfit",f="/crop,g_"+gravityFormat("aliyun",a)+",w_"+o+",h_"+h),r>0&&r<100&&(c="/quality,q_"+r),n="x-oss-process=image/resize,m_"+s+",w_"+o+",h_"+h,n+=f+c;break;case"qcloud":let y="thumbnail";switch((s=="fill"||!a&&a!="center")&&(y="crop",s="fill",f="/gravity/"+gravityFormat("qcloud",a)),r>0&&r<100&&(c="/rquality/"+r),s){case"lfit":t=""+t+">";break;case"mfit":t="!"+t+"r";case"fill":break;case"pad":t=t+"/pad/1";break;case"fixed":t=t+"!";break}n="imageMogr2/"+y+"/"+t+f+c;break;case"qiniu":switch((s=="fill"||!a&&a!="center")&&(s="mfit",f="/gravity/"+gravityFormat("qiniu",a)+"/crop/"+t),r>0&&r<100&&(c="/quality/"+r),s){case"lfit":case"pad":t=t+">";break;case"mfit":t="!"+t+"r";break;case"fill":break;case"fixed":t=t+"!";break}n="imageMogr2/thumbnail/"+t+f+c;break}return i+"?"+n}exports.$url=g;
|