php写的json接口如何将图片压缩?
橱窗的光
橱窗的光 2017-03-14 09:20:09
0
2
905

最近做app用php写的json数据接口,里边涉及很多图片的输出
因为数据来自pc网站,很多图片尺寸较大,体积较大,客户端显示速度较慢 
请教有什么好的办法在输出时缩小图片质量和尺寸呢

橱窗的光
橱窗的光

reply all(2)
数据分析师

How to compress images using the json interface written in php? -PHP Chinese website Q&A-How does the json interface written in PHP compress images? -PHP Chinese website Q&A

Let’s take a look and learn.

迷茫
{
    "prefix" : "host",
    "image_quality" : {
                "low"    : "type_1"
                "middle" : "type_2"
                "high"   : "type_3"
             }
    "image" :[


             ]

}

1.如果有七牛,七牛可以设置各种质量,以拼接后缀的方式,得到的图片大小也不同

2.如果没有接第三方图片服务,那么只能图片上传的时候,做队列,预先在图片服务器做各种质量

3.无论1,2 APP可以根据网络,或者用户的设置喜好,甚至是服务端的控制,按需拼接后缀,解决了图片质量加载的问题


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!