当前位置:Gxlcms > PHP教程 > AdaptiveImagesPHP图片适配类

AdaptiveImagesPHP图片适配类

时间:2021-07-01 10:21:17 帮助过:14人阅读

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/

人气教程排行