PHPackages                             nullaidev/imgix-wp - 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. nullaidev/imgix-wp

ActiveLibrary[Image &amp; Media](/categories/media)

nullaidev/imgix-wp
==================

Add imgix WordPress helpers

v1.2.1(3y ago)023MITPHPPHP &gt;=7.4

Since Dec 16Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/nullaidev/imgix-wp)[ Packagist](https://packagist.org/packages/nullaidev/imgix-wp)[ RSS](/packages/nullaidev-imgix-wp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

imgix for WordPress
-------------------

[](#imgix-for-wordpress)

This composer package contains a few helper methods for working with [imgix](https://imgix.com/) and [WordPress](https://wordpress.org/). This tooling is helpful if you use the WordPress image functions like `wp_get_attachment_image()` and want your URLs rewritten to imgix URLs.

Further, this package can also rewrite your image URLs to [WebP](https://developers.google.com/speed/webp/docs/using) versions if you are not using imgix. Note, this package does not generate WebP images it only rewrites them to WebP if you are not using imgix. If you are using imgix, use [imgix to serve WebP](https://docs.imgix.com/tutorials/improved-compression-auto-content-negotiation) images.

### Install

[](#install)

In your WordPress theme or plugin.

```
composer require nullaidev/imgix-wp
```

Be sure you include the composer's `autoload.php`.

```
// Composer
if(file_exists(__DIR__ . '/vendor/autoload.php')) {
    require __DIR__ . '/vendor/autoload.php';
}
```

### Initialize

[](#initialize)

In your themes `functions.php` file call `\ImgixWp\Core::init()`. When no options are used all image URLs created with `wp_get_attachment_image_src()`, `wp_get_attachment_image()`, and `wp_calculate_image_srcset()` will be rewritten as WebP versions.

```
// functions.php
\ImgixWp\Core::init();
```

*IMPORTANT*: If you don't have WebP versions of your images on your server calling `\ImgixWp\Core::init()` will break your website images leading to 404 errors.

### Generate WebP Images

[](#generate-webp-images)

You can generate your own WebP images in WordPress using the `cwebp` command.

1. First, [download and install the cwebp CLI tool](https://developers.google.com/speed/webp/docs/precompiled).
2. From the command line go to the folder with your images such as `wordpress/wp-content/uploads/{year}/{month}`.
3. Run the following command.
4. Enjoy your webp images.

```
# Example from path, wordpress/wp-content/uploads/2021/01
for file in *; do cwebp -q 50 "$file" -o "${file%.*}.webp"; done
```

### imgix Activation

[](#imgix-activation)

In your themes `functions.php` file call `\ImgixWp\Core::init()` and provide your imgix source URL host name (exclude `https`). The imgix source must point to your `wp-content/uploads` folder.

```
// functions.php
\ImgixWp\Core::init([
    'imgix_host' => 'your-source-name-here.imgix.net'
]);
```

Calling the `\ImgixWp\Core::init()` method will automatically rewrite all of your image URLs to the imgix URL generated by `wp_get_attachment_image_src()`, `wp_get_attachment_image()`, and `wp_calculate_image_srcset()` when they are using on the front-end of your WordPress website.

Raw URLs within content will not be rewritten to an imgix version.

### Helper Functions

[](#helper-functions)

To apply the special query parameters to an image when using `wp_get_attachment_image()` you can use `\ImgixWp\Image::getImage()` instead. The `\ImgixWp\Image::getImage()` has the same signature as `wp_get_attachment_image()` but include another parameter for the query.

For example, to get WebP images served by imgix using the query string `?auto=format` you can use the following:

```
// page.php
$attachment_id = 1;

// WordPress version - ?auto=format is NOT applied
echo wp_get_attachment_image($attachment_id, 'full', false, []);

// imgix version - ?auto=format is applied
echo \ImgixWp\Image::getImage($attachment_id, 'full', false, [], [
    'auto' => 'format'
]);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

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

Every ~77 days

Total

4

Last Release

1381d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbfe05056553c8734d4ecf78fc58966f7d4ba06c664f21a67288f72413d4754f?d=identicon)[kevindees](/maintainers/kevindees)

---

Top Contributors

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

---

Tags

imgixphpwordpresswordpress-development

### Embed Badge

![Health badge](/badges/nullaidev-imgix-wp/health.svg)

```
[![Health](https://phpackages.com/badges/nullaidev-imgix-wp/health.svg)](https://phpackages.com/packages/nullaidev-imgix-wp)
```

###  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)
