PHPackages                             dshovchko/flarum-image-dimensions - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dshovchko/flarum-image-dimensions

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

dshovchko/flarum-image-dimensions
=================================

Automatically adds width and height attributes to images in Flarum posts for better performance and SEO.

v1.5.1(5mo ago)1622↓16.7%2[1 PRs](https://github.com/dshovchko/flarum-image-dimensions/pulls)MITPHP

Since Nov 6Pushed 5mo agoCompare

[ Source](https://github.com/dshovchko/flarum-image-dimensions)[ Packagist](https://packagist.org/packages/dshovchko/flarum-image-dimensions)[ RSS](/packages/dshovchko-flarum-image-dimensions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

Flarum Image Dimensions
=======================

[](#flarum-image-dimensions)

[![MIT license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/dshovchko/flarum-image-dimensions/blob/main/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/3a00b668cfd4c44dc55f1ea54d807b097779ca6dc030c724725adca67c363b44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6473686f7663686b6f2f666c6172756d2d696d6167652d64696d656e73696f6e732e737667)](https://packagist.org/packages/dshovchko/flarum-image-dimensions)[![Total Downloads](https://camo.githubusercontent.com/6415e0eac192c02436a8283ec52b10eca5e286314d7c4ddefe9252c475b66786/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6473686f7663686b6f2f666c6172756d2d696d6167652d64696d656e73696f6e732e737667)](https://packagist.org/packages/dshovchko/flarum-image-dimensions)

A Flarum extension that automatically adds `width` and `height` attributes to images in posts, improving page load performance and preventing layout shifts.

Features
--------

[](#features)

- 🚀 Automatically detects and adds image dimensions
- ⚡ Adds `loading="lazy"` attribute for better performance
- 🔍 Console command to audit existing posts with flexible modes
- 📧 Email reports for batch operations
- ⏰ Scheduled automatic checks (daily/weekly/monthly)
- ⚙️ Configurable check modes (fast/default/full)
- ✅ Supports BBCode, Markdown, and auto-linked images

Installation
------------

[](#installation)

```
composer require dshovchko/flarum-image-dimensions
```

Usage
-----

[](#usage)

### Automatic Processing

[](#automatic-processing)

Once enabled, the extension automatically adds dimensions to all new images posted.

### Scheduled Checks

[](#scheduled-checks)

Configure automatic checks via the admin panel:

1. Go to **Admin → Extensions → Image Dimensions**
2. Enable **Scheduled Checks**
3. Set **Check Frequency** (daily/weekly/monthly)
4. Choose **Check Mode**:
    - **Fast**: Only verify attributes exist
    - **Default**: Verify attributes + URL validity
    - **Full**: Verify exact dimensions
5. Set **Batch Size** (number of discussions per run)
6. Add **Email Recipients** (comma-separated)

> ⚠️ Requires Flarum scheduler to be configured. Add to your crontab:
>
> ```
> * * * * * cd /path/to/flarum && php flarum schedule:run >> /dev/null 2>&1
> ```

### Manual Console Command

[](#manual-console-command)

Audit existing posts using the `image-dimensions:check` console command:

```
# Check a single discussion
php flarum image-dimensions:check --discussion=123

# Check a specific post
php flarum image-dimensions:check --post=456

# Scan all discussions in batches of 250
php flarum image-dimensions:check --all --chunk=250

# Fast mode (verifies only width/height attributes)
php flarum image-dimensions:check --discussion=123 --fast

# Full mode (verifies URLs and actual image dimensions)
php flarum image-dimensions:check --discussion=123 --full

# Email the report
php flarum image-dimensions:check --all --mailto=admin@example.com

# Automatically fix images without dimensions
php flarum image-dimensions:check --discussion=123 --fix
php flarum image-dimensions:check --post=456 --fix
php flarum image-dimensions:check --all --fix --chunk=100
```

> ℹ️ The command requires one of `--discussion=`, `--post=`, or `--all`.

Supported Image Formats
-----------------------

[](#supported-image-formats)

- JPG/JPEG
- PNG
- GIF
- WebP
- SVG/SVGZ

**For AVIF support:** Install [dshovchko/flarum-avif-support](https://packagist.org/packages/dshovchko/flarum-avif-support) extension (requires PHP 8.2+ for dimensions)

Why Image Dimensions Matter
---------------------------

[](#why-image-dimensions-matter)

Adding `width` and `height` attributes to images:

- Prevents Cumulative Layout Shift (CLS)
- Improves Core Web Vitals scores
- Enhances SEO rankings
- Provides better user experience

Requirements
------------

[](#requirements)

- Flarum ^1.0
- PHP 7.4+

Links
-----

[](#links)

- [GitHub Repository](https://github.com/dshovchko/flarum-image-dimensions)
- [Packagist](https://packagist.org/packages/dshovchko/flarum-image-dimensions)
- [Flarum Community](https://discuss.flarum.org)

Release Checklist
-----------------

[](#release-checklist)

1. `cd js && npm ci`
2. `npm run build`
3. `git add js/dist` to include the compiled admin/forum bundles
4. Update `CHANGELOG.md` with the version notes
5. Commit, tag (e.g. `v1.5.1`), and push branch + tag to GitHub
6. Publish the GitHub release and ensure Packagist receives the tag

License
-------

[](#license)

[MIT](https://github.com/dshovchko/flarum-image-dimensions/blob/main/LICENSE)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance70

Regular maintenance activity

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Every ~3 days

Total

7

Last Release

167d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1fa673650ec9d6d6af0b6da7a93aa4426ce230de1fc3af7791bbb20f35d8717d?d=identicon)[dshovchko](/maintainers/dshovchko)

---

Top Contributors

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

---

Tags

lazy loadingperformanceimagesextensionseoflarum

### Embed Badge

![Health badge](/badges/dshovchko-flarum-image-dimensions/health.svg)

```
[![Health](https://phpackages.com/badges/dshovchko-flarum-image-dimensions/health.svg)](https://phpackages.com/packages/dshovchko-flarum-image-dimensions)
```

###  Alternatives

[fof/sitemap

Generate a sitemap

1988.7k2](/packages/fof-sitemap)[fof/mason

Add custom fields to discussions

206.0k](/packages/fof-mason)

PHPackages © 2026

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