PHPackages                             agentsquidflaps/picture - 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. agentsquidflaps/picture

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

agentsquidflaps/picture
=======================

Create flexible picture elements

1.4.3(5y ago)01.2kMITPHPPHP &gt;=7.0CI failing

Since Jul 29Pushed 5y agoCompare

[ Source](https://github.com/agentsquidflaps/picture)[ Packagist](https://packagist.org/packages/agentsquidflaps/picture)[ Docs](https://github.com/agentsquidflaps/picture)[ RSS](/packages/agentsquidflaps-picture/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (22)Used By (0)

Getting started
===============

[](#getting-started)

Install
-------

[](#install)

```
composer install agentsquidflaps/picture

```

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

[](#requirements)

- PHP 7.0 or greater
- GD
- Symfony HTTP foundation 2 or greater
- Intervention image 2.5.1 or greater

### Documentation

[](#documentation)

Please see below for basic usage or you can go to  for more information.

Usage
-----

[](#usage)

Basic usage...

```
new Picture([
    (new PicSum())->setSize(200, 200)
])->setDescription('Your resized image')

```

...this will produce the output...

```

```

So what's this doing?

It's created a standard version and retina version, with a fallback `img` element for browsers that don't support the `picture` element.

### Want some more?

[](#want-some-more)

How about WebP, retina and lazyloaded images! Just do the following (or similar with adapters that allow WebP/retina/lazy loading)...

```
(new Agentsquidflaps\Picture\Picture([
	(new Agentsquidflaps\Picture\Adapter\Intervention())->setSize(200, 200)
]))
->setPath('test.jpg')
->setDescription('Your resized image')
->setRetina(true)
->setWebp(true)
->setLazyLoaded(true)

```

...which will produce the following...

```

```

### Some caveats to the above

[](#some-caveats-to-the-above)

#### Set your env variables

[](#set-your-env-variables)

Firstly, any local source adapters i.e any that get files from a single server, like Intervention, need to know the path for your images. Both the absolute path to your web facing folder and the relative path from your web facing path, to the place you'd like your cached images to sit.

The variables you need to set are...

- `PICTURE_WEB_ROOT`
- `PICTURE_CACHE_RELATIVE_PATH`

...and should be placed in your `.env` file, like so...

```
PICTURE_WEB_ROOT=/var/www/html/public
PICTURE_CACHE_RELATIVE_PATH=/thumbnails

```

#### GD Library

[](#gd-library)

Although, WebP does work on GD library on versions lower than 2.3 (assuming WebP is enabled), it can produce odd results. So it's recommended you use 2.3 or above for best results. GD library 2.3 is available from Ubuntu 18 and up.

#### Lazyloading

[](#lazyloading)

Please see [lazyloading](lazyloading.md) for more information.

### Abstractions

[](#abstractions)

It is highly recommended that you use some sort of abstraction layer. For example with Laravel you might...

```
$app->bind(Source::class, function() {
    return new Intervention();
})

```

...this way you can change images across the board or add defaults, like so...

```
$app->bind(Source::class, function() {
    return (new Intervention())->setFormat('webp');
})

```

...then use it as follows...

```
new Picture([
    $app->make(Source::class)->setSize(200, 200)
])->setDescription('Your resized image')

```

### Laravel functions

[](#laravel-functions)

For those that are using Laravel packages, that is anyone that can call the `app()` function globally, there are helper methods to ease with the above. They are `picture()`, `source()` and `mediaQuery()`. Which can be used as follows...

```
picture([
    source()->setPath('path to image')->setMediaQuery(mediaQuery()->setMinWidth('sm'))
])->setDescription('img description')

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

20

Last Release

2035d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.0

1.0.2PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26868698?v=4)[Timothy Norris](/maintainers/agentsquidflaps)[@agentsquidflaps](https://github.com/agentsquidflaps)

---

Top Contributors

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

---

Tags

imagepictureoptimizermanipulator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/agentsquidflaps-picture/health.svg)

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

###  Alternatives

[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k54.0M161](/packages/league-glide)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M425](/packages/easycorp-easyadmin-bundle)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

506520.9k31](/packages/bkwld-croppa)[intervention/image-laravel

Laravel Integration of Intervention Image

1589.8M226](/packages/intervention-image-laravel)[plank/laravel-mediable

A package for easily uploading and attaching media files to models with Laravel

8291.7M16](/packages/plank-laravel-mediable)[intervention/image-driver-vips

libvips driver for Intervention Image

51222.7k16](/packages/intervention-image-driver-vips)

PHPackages © 2026

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