levineuland / Statamic-Optimus

Enhanced Image Transform Plugin For Statamic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimus Plugin for Statamic

Optimus is an enhanced version of the Statamic transform tag, adding additional rendering effects to make your images as flexible as possible.

What it does:

  • Dynamically adjust brightness and contrast
  • Adds blend modes and filter effects to your images
  • Add solid color or gradient overlays
  • Fully compatible with existing Transform tags

Requirements:

  • Statamic v1.6.7+
  • IMagick PHP Module v3.1.0+ (Note: Only required for effects and blend modes marked with *)

Basic Installation

  1. Create a folder named optimus in the _addons directory of your Statamic site
  2. Put the pi.optimus.php file into that new directory
  3. Insert a {{ optimus }} tag into a page on your site
  4. Add a src atrribute with a path to your image and use any of the modifiers below

Warning: Complex image processing can increase the load time for your website. This plugin leverages the same approach as the Transform plugin, so after the first time you see the image it will not attempt to regenerate it.


###Test Image

To demonstrate the capabilities of this plugin I've used a cropped version of the Lenna standard test image. Below is the unmodified original for comparison.

Original Image


Adjustments

These properties allow you to modify properties of the image before any effects or filters are added.

###Brightness Increases or decreases the brightness of the image. Accepts values from -1 to 1.

brightness=0.5

Brightness Example

###Contrast Increases or decreases the brightness of the image. Accepts values from -1 to 1.

contrast=0.8

Contrast Example


Effects

These properties allow you to modify properties of the image before any effects or filters are added.

###Blur Perform a gaussian blur on the image. Accepts values from 0 to 1.

effect='blur' effect_strength='0.8'

Blur Example

###Pixelate Pixelates the image. Accepts values from 0 to 1.

effect='pixelate' effect_strength='0.3'

Contrast Example

###Greyscale Desaturates the image. Adjusting the strength will increase the contrast of the effect.

effect='greyscale' effect_strength='0.3'

Greyscale Example

###Sepia* Adds a sepia tone to the image.

effect='sepia' effect_strength='0.8'

Greyscale Example

###Noir* Modifies your image to have a film-noir effect.

effect='noir'

Noir Example

###Nashville* Modifies your image to have a sunny/southern effect.

effect='nashville'

Nashville Example

###Gotham* Modifies your image to have a dark, brooding effect.

effect='gotham'

Gotham Example

###Lomo* Modifies your image to have a plastic camera effect.

effect='lomo'

Lomo Example

###Toaster* Modifies your image to have a smooth/warm effect.

effect='toaster'

Toaster Example

###Geocities* Modifies your image to have a look reminiscent of the 90's.

effect='geocities'

Geocities Example

###Noise (Overlay)* Adds random noise with an overlay blend mode to your image.

effect='noise_overlay' effect_strength='0.3'

Noise (Overlay) Example

###Noise (Colorburn)* Adds random noise with a colorburn blend mode to your image.

effect='noise_colorburn' effect_strength='0.3'

Noise (Colorburn) Example

###Noise (Screen)* Adds random noise with a screen blend mode to your image.

effect='noise_screen' effect_strength='0.3'

Noise (Screen) Example

###Noise (Multiply)* Adds random noise with a multiply blend mode to your image.

effect='noise_multiply' effect_strength='0.3'

Noise (Multiply) Example

###GIF Bypasses all effects and returns the original, unaltered gif. Allows for animated gifs to pass through the {optimus} tag.

effect='gif'

Gif Example

###SVG Bypasses all effects and returns the raw XML from your SVG image. Allows you to embed an SVG inline similar to a PHP include.

effect='svg'


Blend Modes

Apply a color and a blend mode to your image. Use the blend_opacity to modify the transparency of the color before the blend mode is applied. These methods are similar to effects found in Photoshop, GIMP, Pixelmator, and Acorn.

###Colorize Applies a colorize blend mode to your image.

blend_mode='colorize' blend_color='#FF0000' blend_opacity='1'

Colorize Example

###Darken* Applies a darken blend mode to your image

blend_mode='darken' blend_color='#009CFF' blend_opacity='1'

Darken Example

###Multiply* Applies a multiply blend mode to your image.

blend_mode='multiply' blend_color='#FF0000' blend_opacity='1'

Multiply Example

###Color Burn* Applies a color burn blend mode to your image.

blend_mode='color_burn' blend_color='#00FFB4' blend_opacity='1'

Color Burn Example

###Screen* Applies a screen blend mode to your image

blend_mode='screen' blend_color='#FF0000' blend_opacity='1'

Screen Example

###Color Dodge* Applies a color dodge blend mode to your image.

blend_mode='color_dodge' blend_color='#6C6B06' blend_opacity='1'

Color Dodge Example

###Overlay* Applies a overlay mode to your image

blend_mode='overlay' blend_color='#FF0000' blend_opacity='1'

Overlay Example

###Hard Light* Applies a hard light blend mode to your image.

blend_mode='hard_light' blend_color='#904545' blend_opacity='1'

Hard Light Example

###Difference* Applies a difference blend mode to your image.

blend_mode='difference' blend_color='#FF0000' blend_opacity='1'

Difference Example

###Hue* Applies a hue blend mode to your image.

blend_mode='hue' blend_color='#FF0000' blend_opacity='1'

Hue Example

###Exclusion* Applies a exclusion blend mode to your image.

blend_mode='exclusion' blend_color='#FF0000' blend_opacity='1'

Exclusion Example


Cover Types

Apply varying cover layers to your image. This action happens at the end of the processing stack, allowing you to add a solid cover or gradient to the top of the image.

###Solid Overlays a solid color on top of your image.

cover_type='solid' cover_color='#000000' cover_opacity='0.5'

Solid Example

###Fade Out Overlays a solid color on top of your image.

cover_type='fade_out' cover_color='#000000' cover_opacity='1'

Solid Example

###Fade Out Multiply* Overlays a vertical gradient with a multiply effect. Currently does not support the cover_opacity property.

cover_type='fade_out_multiply' cover_color='#0000FF'

Solid Example

###Fade Out Screen* Overlays a vertical gradient with a screen effect. Currently does not support the cover_opacity property.

cover_type='fade_out_screen' cover_color='#0000FF'

Solid Example


Transform Settings

Optimus supports all existing Transform tag attributues (Based on the version included in Statamic v1.6.7). You can learn more about these settings on the official Statatmic website.


The End

If you like this plugin please star this repository to let me know. Have a feature or effect you'd like to see added? Send me a message on Twitter @levineuland.

Version History

1.1.0 - Added SVG and Noise effects
1.0.1 - Bug Fixes
1.0.0 - Official Release

Author

Created by Levi Neuland.
Twitter: @levineuland
Website: levineuland.com

About

Enhanced Image Transform Plugin For Statamic


Languages

Language:PHP 100.0%