PHPackages                             picperf/statamic-picperf - 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. picperf/statamic-picperf

ActiveLibrary

picperf/statamic-picperf
========================

1.1.0(3mo ago)2661MITPHP

Since Mar 24Pushed 3mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (16)Used By (0)

PicPerf for Statamic
====================

[](#picperf-for-statamic)

> This thing is a Statamic addon that automatically reformats, optimizes, and aggressively caches your website's images using [PicPerf](https://picperf.io).

Features
--------

[](#features)

- Automatically reformat images to modern, lightweight formats like AVIF and WebP.
- Serve the modern format that's *actually* lighter, and only if your visitor's browser supports it.
- Aggressively cache the bananas out of your images starting from the browser, all the way up to the best global CDN out there.
- The original versions of your images remain untouched.
- Use the [auto-generated sitemap](https://picperf.io/docs/sitemap) for an extra boost of SEO.

Getting Started
---------------

[](#getting-started)

### Create an account.

[](#create-an-account)

In order to benefit from this addon, you'll need to first create an account at [PicPerf](https://picperf.io). 14-day free trial!

### Add your domain.

[](#add-your-domain)

Add your website's domain inside the PicPerf dashboard.

How to Install
--------------

[](#how-to-install)

Search for the PicPerf addon in the `Tools > Addons` section of the Statamic control panel and click **install**, or install it with Composer in the root of your project:

```
composer require picperf/statamic-picperf
```

How to Use
----------

[](#how-to-use)

Out of the box, you need to do nothing. The addon will prefix all image URLs with `https://picperf.io`, allowing them to be automatically optimized &amp; globally cached. Specifically, only the images in HTML `` tags (including responsive images), inline `style` attributes, and CSS within `` tags will be transformed. Image URLs in separate `.css` files or those injected with client-side JavaScript will not be affected.

### Publishing Your Configuration

[](#publishing-your-configuration)

If you need to customize the addon's behavior, you can publish the configuration file to your project:

```
php artisan vendor:publish --tag=picperf-config
```

This will copy the `picperf.php` configuration file to your `config/` directory, where you can modify it as needed.

### Local Development

[](#local-development)

In order for prefixed images to load, PicPerf requires them to be publicly available, which is likely not the case when working locally. To address this, in local development, all images that *will be* optimized with PicPerf will have the `picperf_local=true` query parameter:

```
https://example.com/my-image.jpg?picperf_local=true

```

This behavior will only occur in lower environments — by default, defined as either `local` or `testing`. If you'd like to change the environments where local images will be loaded, modify the `lower_enviornments` configuration option:

```
