PHPackages                             waughj/wp-theme-image - 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. waughj/wp-theme-image

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

waughj/wp-theme-image
=====================

Class for autogenerating HTML for WordPress theme image.

v0.4.0(6y ago)01012AGPL-3.0-or-laterPHPPHP &gt;=7.0

Since May 13Pushed 6y agoCompare

[ Source](https://github.com/waughjai/wp-theme-image)[ Packagist](https://packagist.org/packages/waughj/wp-theme-image)[ RSS](/packages/waughj-wp-theme-image/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (4)Versions (8)Used By (2)

WP Theme Image
==============

[](#wp-theme-image)

Class for autogenerating HTML for WordPress theme image.

Works just like HTMLImage class, but autogenerates the FileLoader to fit WordPress’s theme directory.

Local directory within theme directory can be set on an image-by-image basis by setting the “directory” key in the $attributes hash map to the desired local directory string.

For example, in a theme named “blue” setup on localhost:

```
use WaughJ\WPThemeImage\WPThemeImage;

$image = new WPThemeImage( 'demo.png', [ 'directory' => 'img' ] );
$image->print(); // Will print  ( #s after m= will vary ).

```

Or you can globally set the default local directory with the static method setDefaultSharedDirectory():

```
use WaughJ\WPThemeImage\WPThemeImage;

$image = new WPThemeImage( 'demo.png' );
$image->print(); // Will print  ( #s after m= will vary ).

WPThemeImage::setDefaultSharedDirectory( 'pictures' );

$image = new WPThemeImage( 'demo.png' );
$image->print(); // Will now print  ( #s after m= will vary ).

```

Error Handling
--------------

[](#error-handling)

As a child o’ HTMLImage, WPThemeImage will throw an exception if it’s set to show versioning ( default ) &amp; can’t find the file on the server. Read the HTMLImage documentation to learn mo’ ’bout this. WPThemeImage works the same way:

```
try
{
	$image = new WPThemeImage( 'missing.jpg' );
}
catch ( MissingFileException $e )
{
	$image = $e->getFallbackContent();
}
$image->print() // Will print  without throwing an error.

```

Changelog
---------

[](#changelog)

### 0.4.0

[](#040)

- Add function for getting URL directory.

### 0.3.0

[](#030)

- Integrate HTMLImage Autogeneration o’ Sizes Attribute &amp; Shorthand Srcset Format

### 0.2.0

[](#020)

- Apply HTMLImage HTML Cache Optimization

### 0.1.0

[](#010)

- Initial Release

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

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 ~18 days

Recently: every ~26 days

Total

7

Last Release

2451d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11161078?v=4)[waughj](/maintainers/waughj)[@waughj](https://github.com/waughj)

---

Top Contributors

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

---

Tags

wordpressimagetheme

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/waughj-wp-theme-image/health.svg)

```
[![Health](https://phpackages.com/badges/waughj-wp-theme-image/health.svg)](https://phpackages.com/packages/waughj-wp-theme-image)
```

###  Alternatives

[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

141110.4k6](/packages/stefangabos-zebra-image)[toinekamps/responsive-pics

Responsive Pics is a Wordpress tool for resizing images on the fly.

831.2k](/packages/toinekamps-responsive-pics)

PHPackages © 2026

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