Adaptive Images PHP图片适配类
程序员文章站
2022-05-03 20:06:43
...
Adaptive Images是一个PHP编写的工具,它可将图像传输到小型移动设备上。应用嵌入式解决方案会根据设备屏幕大小 自动创建、捕捉、传输图片,而不需要额外改动图像。
使用方法
一、在图片文件夹创建.htaccess文件
Options +FollowSymlinks
RewriteEngine On
# Adaptive-Images -----------------------------------------------------------------------------------
# Add any directories you wish to omit from the Adaptive-Images process on a new line, as follows:
# RewriteCond %{REQUEST_URI} !ignore-this-directory
# RewriteCond %{REQUEST_URI} !and-ignore-this-directory-too
RewriteCond %{REQUEST_URI} !assets
# Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above directories
# to adaptive-images.php so we can select appropriately sized versions
RewriteRule .(?:jpe?g|gif|png)$ adaptive-images.php
# END Adaptive-Images -------------------------------------------------------------------------------
二、将如下JS脚本复制到每个需要自适应图片的网页的头部
三、HTML代码
test Example in action
项目地址:http://adaptive-images.com/
上一篇: 开发大型PHP项目的方法二