PHPackages                             lipowei/imglazyload - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. lipowei/imglazyload

Abandoned → [tcwei/imglazyload](/?search=tcwei%2Fimglazyload)Library[Image &amp; Media](/categories/media)

lipowei/imglazyload
===================

文章图片懒加载，当文章中存在大量图片时，可使用该库进行图片懒加载，看不到的图片不进行加载，节省带宽

v1.2(5y ago)092MITPHP

Since Jun 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ITzhiwei/ArticleImgLazyload)[ Packagist](https://packagist.org/packages/lipowei/imglazyload)[ RSS](/packages/lipowei-imglazyload/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP 使文章图片懒加载
============

[](#php-使文章图片懒加载)

介绍
--

[](#介绍)

没有任何依赖，可在任何环境下使用，开箱即用 文章图片懒加载，当文章中存在大量图片时，可使用该库进行图片懒加载，看不到的图片不进行加载，节省带宽
可以设置当距离可见区域多少PX时即进行加载图片，这样可使用户无感知

安装
--

[](#安装)

```
方式1、使用 composer 命令安装：composer require tcwei/imglazyload
方式2、直接在 src 找到 ArticleImgLazyload.php 类库文件，直接拖到你的类目录内，include 该文件可直接使用

```

使用
--

[](#使用)

```
use tcwei\smallTools\ArticleImgLazyload;
$ArticleImgLazyload = new ArticleImgLazyload;
$newContent = $ArticleImgLazyload->getNewContent($articleContent);
//将这个$newContent给前端使用即可
echo $newContent;

```

参数介绍
----

[](#参数介绍)

- $ArticleImgLazyload-&gt;imgPrefix

```
string
给图片路径加前缀，一般为APP使用，网站可忽略
一般编辑器写的文章不会给编辑器加域名的，这样抽取文章给APP渲染时无法读取图片
如：$ArticleImgLazyload->imgPrefix = 'http://www.aaa.com';
文章内容中的图片路径都在加上 http://www.aaa/com 这个前缀

```

- $ArticleImgLazyload-&gt;timeLazyload

```
int
当到达可见区域时是否延迟加载，单位毫秒，默认为0；
一般无需要设置，如果要看懒加载效果，可以设置为2000进行查看

```

- $ArticleImgLazyload-&gt;defaultImg

```
string
当图片未加载完成时显示的图片
默认：http://image2.sina.com.cn/blog/tmpl/v3/images/default_s_bmiddle.gif

```

- $ArticleImgLazyload-&gt;distance

```
int
距离可见区域多少PX时进行加载图片，默认为100

```

- $ArticleImgLazyload-&gt;blacklist

```
string
不参与懒加载的图片地址关键词
例如传入baidu，即代表图片地址含有baidu的都不会进行懒加载，排除掉 ueditor 写文章时编辑器自带的表情图

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2151d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/64b02e6dd1c2046465a92a43050180747375fed27151c08abc2a336d83968d92?d=identicon)[ITwuzhiwei](/maintainers/ITwuzhiwei)

---

Top Contributors

[![ITzhiwei](https://avatars.githubusercontent.com/u/31977386?v=4)](https://github.com/ITzhiwei "ITzhiwei (4 commits)")

### Embed Badge

![Health badge](/badges/lipowei-imglazyload/health.svg)

```
[![Health](https://phpackages.com/badges/lipowei-imglazyload/health.svg)](https://phpackages.com/packages/lipowei-imglazyload)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
