hj419520114 發表於 2022-5-2 00:09:47

Discuz!X3.4手机版上传原图,不压缩图片

打开:static/js/mobile/buildfileupload.js<br />删除下边代码,后台和浏览器更新缓存即可<ol><li>if(imgwidth/imgheight &lt;= canvaswidth/canvasheight &amp;&amp; imgheight &gt;= canvasheight) {<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;newheight = canvasheight;<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;newwidth = Math.ceil(canvasheight/imgheight*imgwidth);<br /><li>} else if(imgwidth/imgheight &gt; canvaswidth/canvasheight &amp;&amp; imgwidth &gt;= canvaswidth) {<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;newwidth = canvaswidth;<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;newheight = Math.ceil(canvaswidth/imgwidth*imgheight);<br /><li>}</ol><br />注意,手机图片像素大,GD库可能无法处理导致上传失败,所以,可以考虑提高最大高度和宽度的限制,而不一定传原图,教程如下(未进行上边的删除的情况下)<br /><br />打开:static/js/mobile/buildfileupload.js<br />找到<br /><ol><li>var maxheight = 500;<br /><li>var maxwidth = 500;</ol>调大数字<br /><br />js<em>, </em>打开<em>, </em>static<em>, </em>mobile<em>, </em>buildfileupload

技术控 發表於 2022-5-2 12:44:44

感谢教程,原图是太大了,能像后台一样设置压缩比最好

ysx24 發表於 2022-5-2 12:49:13

太感谢了,最近也遇到这个问题。

fsmn 發表於 2022-5-2 17:56:00

感谢……

276397082 發表於 2023-3-13 21:18:19

3.5也是,删了代码也没解决 @dashen

danhuangyou 發表於 2023-3-16 13:48:08

每太看懂,请问这个改动目的是压缩原图还是不压缩原图
頁: [1]
查看完整版本: Discuz!X3.4手机版上传原图,不压缩图片