当前位置:网站首页>七牛图片访问参数(缩略图小尺寸啥的,避免浪费流量)
七牛图片访问参数(缩略图小尺寸啥的,避免浪费流量)
2022-06-29 18:29:00 【杭杭爸爸】
timthumb.php是一个专门为WordPress开发的缩略图应用项目,为了使主题缩略图内容大小一致,越来越多的主题开始使用timthumb。但是timthumb要求主机支持GD库,且缩略图是动态生成缓存到服务器的,会消耗一定的服务器资源。如果站点图片文件过多,会对服务器负载造成很大的影响。建议使用七牛缩略图高级处理imageMogr2的thumbnail功能替代timthumb.php缩略图,以达到缓解服务器压力,加速图片访问的目的。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
七牛云存储服务支持图片缩略、裁剪、旋转、转化等功能,各网站一般介绍的是使用七牛的图片基本处理imageView2实现缩略图功能,但由于imageView2只能对图片进行简单的等比例缩放,如果网站图片大小比例不一,很难达到统一图片大小的目的。而imageMogr2是七牛图片的高级处理接口,借助imageMogr2可以轻松统一网站缩略图的大小。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
实现统一缩略图大小主要使用到imageMogr2的thumbnail操作,thumbnail操作参数表如下:文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/!<Scale>p : 基于原图大小,按指定百分比缩放。取值范围为0-1000。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/!<Scale>px :以百分比形式指定目标图片宽度,高度不变。取值范围为
0-1000。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html/thumbnail/!x<Scale>p :以百分比形式指定目标图片高度,宽度不变。取值范围为
0-1000。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html/thumbnail/<Width>x :指定目标图片宽度后高度等比缩放。取值范围为0-10000。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/x<Height> : 指定目标图片高度后宽度等比缩放。取值范围为0-10000。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/<Width>x<Height> :限定长边,短边自适应缩放,将目标图片限制在指定宽高矩形内。取值范围不限,但若宽高超过10000时只能缩不能放。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/!<Width>x<Height>r :限定短边,长边自适应缩放,目标图片会延伸至指定宽高矩形外。取值范围不限,但若宽高超过10000时只能缩不能放。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/<Width>x<Height>! :限定目标图片宽高值,忽略原图宽高比例,按照指定宽高值强行缩略,可能导致目标图片变形。取值范围不限,但若宽高超过10000时只能缩不能放。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/<Width>x<Height>> :当原图尺寸大于给定的宽度或高度时,按照给定宽高值缩小。取值范围不限,但若宽高超过10000时只能缩不能放。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/<Width>x<Height>< :当原图尺寸小于给定的宽度或高度时,按照给定宽高值放大。取值范围不限,但若宽高超过10000时只能缩不能放。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
/thumbnail/<Area>@ :按原图高宽比例等比缩放,缩放后的像素数量不超过指定值。取值范围不限,但若像素数超过25000000时只能缩不能放。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
如要使网站所有缩略图图片大小相同,必须强制固定缩略图的宽度和高度,通过分析以上参数表发现imageMogr2/thumbnail/<Width>x<Height>!参数完全可以满足要去。如你站点的图片文件已经托管到了七牛,则可以直接利用这个参数实现固定长宽的缩略图。文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
如本站有所有缩略图大小为280x210,可以在图片后加如下参数实现所有缩略图大小为280x210:文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html
http://developer.qiniu.com/resource/gogopher.jpg?imageMogr2/thumbnail/280x210!文章源自堕落的鱼-https://www.duoluodeyu.com/2250.html

边栏推荐
- jdbc_ Related codes
- How do I add SmartArt to slides in PowerPoint?
- Error building SqlSession问题
- 1. 使用STM32CubeMX建立STM32G030C8T6项目工程
- Stepping on the pit: json Parse and json stringify
- BeanUtils属性复制的用法
- The table ‘table_name‘ is full 异常排查及解决方案
- What is a multi paradigm programming language and what does "multi paradigm" mean?
- MySQL 企業級開發規範
- Svg circle drawing path animation
猜你喜欢

Apache Doris 基本使用总结

Know that Chuangyu has helped the energy industry in asset management and was selected into the 2021 IOT demonstration project of the Ministry of industry and information technology

Understanding of strong caching and negotiation caching

How to use the low code platform of the Internet of things for service management?

对强缓存和协商缓存的理解

Up to 81.98%! Announcement of undergraduate study rate of more than 100 "double first-class" Universities

jdbc_相關代碼

C Primer Plus 第12章_存储类别、链接和内存管理_代码和练习题

Request header field XXXX is not allowed by access control allow headers in preflight response

2. 银河麒麟离线模式下如何安装MySQL数据库
随机推荐
山东大学项目实训(七)添加导航栏选择城市
Anfulai embedded weekly report no. 271: June 20, 2022 to June 26, 2022
[how the network is connected] Chapter 3 explores hubs, switches and routers
【网络是怎么连接的】第三章 探索集线器,交换机和路由器
unittest单元测试框架
程序员资源推荐指南
SD6.23集训总结
BeanUtils属性复制的用法
JWT登录验证
Sd6.24 summary of intensive training
面霸篇:MySQL六十六问,两万字+五十图详解!
Sister Juan takes you to learn database -- 5-day dash day4
Fastdfs
These advantages of the Institute are really fragrant! The landing rate is still very high!
Error building sqlsession problem
The table ‘table_ Name 'is full exception troubleshooting and solution
jdbc_相關代碼
How to use the low code platform of the Internet of things for service management?
RocketMQ的tag过滤和sql过滤
产品-Axure9(英文版),中继器(Repeater)实现表格内容的增删查改(CRUD)