Craft CMS

Transform Image URLs in Craft CMS using Gumlet image plugin

Transform your Craft CMS images using Gumlet's powerful image transformation service. This plugin provides seamless integration, replacing Craft's native image transforms with Gumlet's on-the-fly image processing, giving you access to advanced image optimization and transformation features.

Requirements

  • Craft CMS 4.0.0 or later
  • PHP 8.0.2 or later
  • A Gumlet account and domain

Installation

Craft CMS Plugin Marketplace: https://plugins.craftcms.com/gumlet-imagetransformer

  1. Install the plugin via Composer:
    composer require gumlet/craft-gumlet-imagetransformer

  2. Install the plugin in Craft CMS:
    php craft plugin/install gumlet-imagetransformer
  3. Copy the config file:
    cp vendor/gumlet/craft-gumlet-imagetransformer/src/config.php config/gumlet-imagetransformer.php
  4. Update your config/gumlet-imagetransformer.php with your Gumlet domain:
    return [
        'gumletDomain' => 'your-domain.gumlet.io',
        'enabled' => true,
        'defaultQuality' => 80,
        'defaultFormat' => 'auto',
    ];

Usage

Method 1: Twig Function (Recommended)

The easiest way to generate Gumlet URLs:

{# Basic usage #}
<img src="{{ gumletUrl(asset, { width: 300, height: 300 }) }}" alt="{{ asset.title }}" />

{# With additional Gumlet parameters #}
<img src="{{ gumletUrl(asset, { width: 300, height: 300 }, { blur: 10, brightness: 5 }) }}" alt="{{ asset.title }}" />

{# With quality and format #}
<img src="{{ gumletUrl(asset, { width: 500, height: 500, quality: 85, format: 'webp' }) }}" alt="{{ asset.title }}" />

Method 2: Service Method

Use the Gumlet service directly:

{# Basic usage #}
<img src="{{ craft.gumlet.buildUrl(asset, { width: 300, height: 300 }) }}" alt="{{ asset.title }}" />

{# With Gumlet-specific parameters #}
<img src="{{ craft.gumlet.buildUrl(asset, { width: 300, height: 300 }, { blur: 10 }) }}" alt="{{ asset.title }}" />