PHPackages                             aerni/paparazzi - 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. aerni/paparazzi

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

aerni/paparazzi
===============

Generate images of your entries and terms

65PHP

Since May 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/aerni/statamic-paparazzi)[ Packagist](https://packagist.org/packages/aerni/paparazzi)[ RSS](/packages/aerni-paparazzi/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

[![Statamic](https://camo.githubusercontent.com/66aa060ef58fed4f05a82cb2f2eba009a626cb506f93ad3ebcd4cb9d5e56ae7f/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f53746174616d69632f332e342b2f464632363945)](https://camo.githubusercontent.com/66aa060ef58fed4f05a82cb2f2eba009a626cb506f93ad3ebcd4cb9d5e56ae7f/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f53746174616d69632f332e342b2f464632363945) [![Packagist version](https://camo.githubusercontent.com/e523c1332611ad6d2302ac4c1d9ee27ca17d7103069847dda159c017153f83e3/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f6165726e692f7061706172617a7a692f6c6174657374)](https://camo.githubusercontent.com/e523c1332611ad6d2302ac4c1d9ee27ca17d7103069847dda159c017153f83e3/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f6165726e692f7061706172617a7a692f6c6174657374) [![Packagist Total Downloads](https://camo.githubusercontent.com/77a420cce0746e9d1123be3aefc667bf4d4de80cb173fc40585b065df33a6e02/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f6165726e692f7061706172617a7a69)](https://camo.githubusercontent.com/77a420cce0746e9d1123be3aefc667bf4d4de80cb173fc40585b065df33a6e02/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f6165726e692f7061706172617a7a69)

Paparazzi
=========

[](#paparazzi)

This addon provides an easy-to-use interface to generate images of your entries and terms. A common use case would be to generate social images for Open Graph and Twitter.

Prerequisite
------------

[](#prerequisite)

Paparazzi uses [Browsershot](https://github.com/spatie/browsershot) to generate the images and requires a working installation of [Puppeteer](https://github.com/puppeteer/puppeteer) on your server and local machine.

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

[](#installation)

Install the addon using Composer:

```
composer require aerni/paparazzi
```

The config will be automatically published to `config/paparazzi.php` as part of the installation process.

Configuring Models
------------------

[](#configuring-models)

The first thing you should do is to configure your models in `config/paparazzi.php`. You can add as many models as you like. The only requirement for a model is the `width` and `height`. All other configuration options are passed down from the `defaults` array. You may override any default value by setting it on the model itself.

```
'models' => [

    'open_graph' => [
        'width' => 1200,
        'height' => 630,
    ],

    'instagram_post' => [
        'width' => 1080,
        'height' => 1080,
        'extension' => 'jpeg',
        'quality' => 80,
        'container' => 'instagram',
    ],

],
```

Layouts &amp; Templates
-----------------------

[](#layouts--templates)

Next, you should create your first layout and templates for your models. Use the following commands to do so:

CommandDescription`paparazzi:layout`Create a new Paparazzi layout view`paparazzi:template`Create a new Paparazzi model template viewThe views will be saved to `resources/views/paparazzi`. If you'd like to use another path, you can change it in the config.

Working with models
-------------------

[](#working-with-models)

A model will be created for each template that exists for a given model. The ID of a model will constructed from the model's handle and its template. Let's say you have an `open_graph` model with a `default`, `article`, and `video` template. This would result in three models with IDs of `open_graph::default`, `open_graph::article`, and `open_graph::video`.

Use the `Model` facade to get a model by its ID:

```
use Aerni\Paparazzi\Facades\Model;

Model::find('open_graph::default');
```

Alternatively, you can use the model's handle as the method and pass the template as an argument:

```
Model::openGraph('default');
```

If you don't pass the template as an argument, you will get the model with the default template as defined in the `config('paparazzi.defaults.template')`. If you don't have a template with that name, it will return the first model it can find.

```
Model::openGraph();
```

You can also get all the models at once:

```
Model::all();
```

Or only a selection of models:

```
Model::all(['open_graph::defaults', 'twitter::article']);
```

Or get all the models of a specific type:

```
Model::allOfType('open_graph');
```

Generating an image
-------------------

[](#generating-an-image)

Now you can simply call the `generate()` method on the model:

```
Model::openGraph()->generate();
```

Or generate the image in the background by dispatching a job:

```
Model::openGraph()->dispatch();
```

If you want the data of an entry or term available in the template, you can add the entry/term with the `content()` method:

```
Model::openGraph()->content($entry)->generate();
```

Generate the images of all models with the content of an entry.

```
Model::all()->each->content($entry)->generate();
```

You can also pass a callback to the `generate` or `dispatch` method to configure the browsershot instance.

```
Model::twitter()->generate(fn ($browsershot) => $browsershot->fullPage());
```

Asset management
----------------

[](#asset-management)

The generated images will be saved as a Statamic asset. The asset container, directory, and file reference can be changed in the config.

### Variables

[](#variables)

You may use a couple of variables to customize the directory and file reference.

VariableDescriptionAvailability`{model}`The handle of the modelAlways`{layout}`The handle of the layoutAlways`{template}`The handle of the templateAlways`{type}`Evaluates to either `collections` or `taxonomies`Only with content`{parent}`The handle of the collection or taxonomyOnly with content`{site}`The site of the entry or termOnly with content and on multi-sites`{slug}`The slug of the entry or termOnly with content### File Reference

[](#file-reference)

The reference is used to get the generated images that belong to a model.

```
'directory' => '{type}/{parent}/{site}/{slug}',
'reference' => '{model}-{layout}-{template}-{parent}-{site}-{slug}',
```

Previewing Templates
--------------------

[](#previewing-templates)

You may preview your templates in the browser according to the following URL schema. The preview is only available in `local` environment.

```
// Schema
/{preview_url}/{model}

// Example
/paparazzi/open_graph

```

This will return the default template of the `open_graph` model. To show a different model, provide the full ID instead:

```
/paparazzi/open_graph::article

```

You may also change the layout that is used with the `layout` parameter:

```
/paparazzi/open_graph::article?layout=secondary

```

To add the content of an entry or term to the rendered template, add the `content` query parameter containing the entry's or term's ID.

```
// Entry ID
/paparazzi/open_graph::article&content=c3d19675-c7b8-49c5-84eb-9c5eb9713644

// Term ID
/paparazzi/open_graph::article&content=cars::audi

```

Use the optional `site` parameter to get the entry or term in a specific localization.

```
/paparazzi/open_graph::article&content=c3d19675-c7b8-49c5-84eb-9c5eb9713644?site=german

```

Live Preview
------------

[](#live-preview)

Add a model to the Live Preview of all collections:

```
public function handle(EntryBlueprintFound $event)
{
    Model::openGraph()->addLivePreviewToCollection();
}
```

Add a model to the Live Preview of a specific collection:

```
public function handle(EntryBlueprintFound $event)
{
    Model::openGraph()->addLivePreviewToCollection('pages');
}
```

Add a model to the Live Preview of multiple selected collection:

```
public function handle(EntryBlueprintFound $event)
{
    Model::openGraph()->addLivePreviewToCollection(['pages', 'articles']);
}
```

Add a model to the Live Preview of all taxonomies:

```
public function handle(EntryBlueprintFound $event)
{
    Model::openGraph()->addLivePreviewToTaxonomy();
}
```

Add a model to the Live Preview of a specific taxonomy:

```
public function handle(EntryBlueprintFound $event)
{
    Model::openGraph()->addLivePreviewToTaxonomy('categories');
}
```

Add a model to the Live Preview of multiple selected taxonomies:

```
public function handle(EntryBlueprintFound $event)
{
    Model::openGraph()->addLivePreviewToTaxonomy(['categories', 'tags']);
}
```

You can also add a model to collections and taxonomies at the same time:

```
public function handle(TermBlueprintFound $event)
{
    Model::openGraph()
        ->addLivePreviewToCollection(['pages', 'articles']);
        ->addLivePreviewToTaxonomy('tags');
}
```

License
-------

[](#license)

Paparazzi is free to use software but may not be reused in other projects without the express written consent of Michael Aerni.

Credits
-------

[](#credits)

Developed by [Michael Aerni](https://michaelaerni.ch)

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23167701?v=4)[Michael Aerni](/maintainers/aerni)[@aerni](https://github.com/aerni)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/aerni-paparazzi/health.svg)

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

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

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