企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 图片处理 > 图片是很重要的媒体元素,用好了,页面会更加美观,巧妙的利用图片自适应特性,页面的适配性也会更好。 基于tp的图片处理方案。 - 裁剪 - 缩放 - 压缩(服务器安装开源压缩方案) - 缓存 - 提供直接输出图片流的地址/提供处理完成的图片地址 - 占位图生成(支持输出date-base64-url编码形式) - 满足移动端,2倍图@2x.png * * * * * ### 扩展 [移动端1px解决之道及2、3倍图处理方法 - 简书](https://www.jianshu.com/p/eba6bedd25b0) [javascript - 前端页面(移动端)使用二倍图比一倍图有什么好处呢? - SegmentFault 思否](https://segmentfault.com/q/1010000010733030) [H5案例分享:Retina显示屏-揭秘移动端的视觉稿通常会设计为传统PC的2倍_H5案例分享](https://www.h5anli.com/articles/201610/retina.html) [移动端前端适配方案对比 - 简书](https://www.jianshu.com/p/e5ca5b78e03e) >[danger] 高度定死,宽度自适应(这样会怪怪的,很丑,如果是图片的话会被拉伸的,**反而不固定高度的话,利用图片特有的特性,图片会按照原图宽高比例进行等比缩放,自适应的**,但是这样在图片未加载完毕时没有宽高,会有闪动问题,不过可以利用预先设置好比例的占位图base64形式来做,原本图片也按照相同比例进行处理,这样就解决了闪动问题。同时resize时还能自适应,而无需用js来resize动态计算设置了等比宽高了。) [Yupoo! 的网站技术架构 | DBA Notes](http://dbanotes.net/arch/yupoo_arch.html) [ImageMagick简介、GraphicsMagick、命令行使用示例 - CSDN博客](https://blog.csdn.net/cbbbc/article/details/52175559) [PHP极其强大的图片处理库Grafika详细教程(1):图像基本处理 - CSDN博客](https://blog.csdn.net/qq_34657922/article/details/79479892) [GD、ImageMagick、GraphicsMagick - CSDN博客](https://blog.csdn.net/baiwz/article/details/38420187) [谷歌开源图片压缩算法Guetzli实测体验报告 - 腾讯云+社区 - 博客园](https://www.cnblogs.com/qcloud1001/p/6595336.html) [最有效地使用PNG:PNGOUT优化 - CSDN博客](https://blog.csdn.net/happydeer/article/details/50473961) ~~~ 于是,我们有了第一条经验:永远别保存交错格式的PNG文件。 仅仅是为了渐进式渲染,交错式PNG会增大35%; 渐进式渲染让人很困惑:图像一开始是模糊的,然后渐渐变清晰。Philip Greenspun一语道破,“读者无法判断图像何时加载完毕!” 标准的PNG为渐进式渲染提供了完美的解决方法,根本用不着交错格式。它们可以自顶向下,以一种很简单直接的方式渲染。 可是自顶向下,加载时无法获知高度,会有闪动问题,难道图片没完全加载完毕也能预先输出高度信息吗,高度信息在图片head里?不过任何时候,都不要相信在图片未加载完毕时能得到图片的高度,这是不可靠的,所以有要求的还是用base64占位图吧。 ~~~ [生成微缩图 · php笔记 · 看云](https://www.kancloud.cn/xiak/php-node/248832) [用 imgproxy 自动缩放图片](https://mp.weixin.qq.com/s/25Pt37Xe9_MdyJEX4Lm0eg) [php扩展Imagick库,如何实现gif转webp - 开源中国社区](https://www.oschina.net/question/3783935_2274428) [WebPconv | WebP File Converter | Romeolight](http://www.romeolight.com/products/webpconv/) [关于Android图片资源瘦身的奇思妙想 - 云+社区 - 腾讯云](https://cloud.tencent.com/developer/article/1004331) [【腾讯云的1001种玩法】 Laravel 整合万向优图图片管理能力,打造高效图片处理服务 - 云+社区 - 腾讯云](https://cloud.tencent.com/developer/article/1004595) [图片流量节省大杀器:基于 CDN 的 sharpP 自适应图片技术实践 - 云+社区 - 腾讯云](https://cloud.tencent.com/developer/article/1004404) [快速使用OSS图片服务_图片处理指南_对象存储 OSS-阿里云](https://help.aliyun.com/document_detail/44686.html?spm=5176.8465980.img.ddetails.4e701450oW1H4t) (支持在 OSS 端对图片文件进行缩放、裁剪、水印等处理) > 阿里云等OOS存储支持图片处理,可以直接充当图片服务器 * * * * * ### 相关开源项目 [PHP: GD 和图像处理 函数 - Manual](http://www.php.net/manual/zh/ref.image.php) [图像处理 · ThinkPHP5.0完全开发手册 · 看云](https://www.kancloud.cn/manual/thinkphp5/177530) [Convert, Edit, Or Compose Bitmap Images @ ImageMagick](http://www.imagemagick.org/script/index.php) [GraphicsMagick Image Processing System](http://www.graphicsmagick.org/) [google/guetzli: Perceptual JPEG encoder](https://github.com/google/guetzli)(Google开源的JPEG图片压缩算法,终于有个) [TinyPNG – API Reference](https://tinypng.com/developers/reference/php) [pngquant — lossy PNG compressor](https://pngquant.org/) [Intervention/image: PHP Image Manipulation](https://github.com/Intervention/image) [avalanche123/Imagine: PHP 5.3 Object Oriented image manipulation library](https://github.com/avalanche123/Imagine) [AlloVince/EvaThumber: A light-weight url based image transformation php library](https://github.com/AlloVince/EvaThumber)(基于URL的图片处理库 (可实现缩略图 | 二维码 | 水印 | 面部识别等,基于PHP) [kosinix/grafika: An image processing library for PHP](https://github.com/kosinix/grafika) [george518/CoreImage: 裁剪核心图片](https://github.com/george518/CoreImage) [pel/pel: PHP Exif Library - library for reading and writing Exif headers in JPEG and TIFF files using PHP.](https://github.com/pel/pel)(PHP Exif) [Ken Silverman's Utility Page](http://advsys.net/ken/utils.htm) [flyimg/flyimg: Dockerized PHP7 application runs as a Microservice to resize and crop images on the fly. Get optimised images with MozJPEG, WebP or PNG using ImageMagick. Includes face detection, cropping, face blurring, image rotation and many other options. Abstract storage based on FlySystem in order to store images on any provider (local, AWS S3...).](https://github.com/flyimg/flyimg) [rakibtg/PHP-ImageToWebp: A PHP class to convert JPG, JPEG, PNG or GIF images to webp format](https://github.com/rakibtg/PHP-ImageToWebp)(JPG, JPEG, PNG or GIF 图片格式 转换为 webp格式图片) [weserv/images: Source code of images.weserv.nl, to be used on your own server(s).](https://images.weserv.nl/#quick-reference)(一个成熟的图像处理方案,除了支持一些常规的图片处理外,还支持图片模糊,灰度,圆形裁剪等有意思的处理) [ImageOptim HTTP API for optimization on web servers](https://imageoptim.com/api) [EvaThumber : 基于URL的图片处理库 (可实现缩略图 | 二维码 | 水印 | 面部识别等,基于PHP)](https://avnpc.com/pages/evathumber) * * * * * last update:2018-7-4 14:55:58