Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

用nodejs写的博客,文章列表的图片是从富文本里取的URL,然后直接拿着这个URL去跟服务器要原图了,请问这个图片能压缩吗

能怎么压缩优化一下吗


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

首先要明确该图片地址是否为第三方资源,像七牛、又拍云、阿里oss都会有图片压缩方案,一般都是在链接后拼接压缩参数,如:http://cdn.image.com/image1/300/200 ,其中 300/200就是图片宽高

如果自己实现压缩功能,可以使用图片压缩库 https://github.com/zhangyuanw...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...