Skip to content
Snippets Groups Projects
Select Git revision
  • 3357133-divisionbyzeroerror-on-aspectswitcherimageeffect
  • 8.x-3.x default
  • image_effects-3357133-3357133-divisionbyzeroerror-on-aspectswitcherimageeffect
  • 8.x-2.x
  • 8.x-1.x
  • 8.x-3.4
  • 8.x-3.3
  • 8.x-3.2
  • 8.x-3.1
  • 8.x-3.0
  • 8.x-3.0-rc2
  • 8.x-3.0-alpha1
  • 8.x-3.0-rc1
  • 8.x-1.3
  • 8.x-2.3
  • 8.x-1.2
  • 8.x-2.2
  • 8.x-1.1
  • 8.x-2.1
  • 8.x-2.0
  • 8.x-2.0-beta1
  • 8.x-1.0
  • 8.x-1.0-beta1
  • 8.x-1.0-alpha5
  • 8.x-1.0-alpha4
25 results

image_effects-3357133

  • Clone with SSH
  • Clone with HTTPS
  • Forked from project / image_effects
    46 commits behind, 1 commit ahead of the upstream repository.
    Robert Phillips's avatar
    Issue #3357133 by robphillips: DivisionByZeroError on AspectSwitcherImageEffect.
    Rob Phillips authored
    79ba674b
    History

    Image Effects module

    Project page: https://drupal.org/project/image_effects

    Introduction

    The Image Effects module provides a suite of additional image effects that can be added to image styles and UI components that can be used in the image effects configuration forms.

    Image styles let you create derivations of images by applying (a series of) effect(s) to it. Think of resizing, desaturating, masking, etc.

    Image Effects tries to support both the GD toolkit from Drupal core and the ImageMagick toolkit. However, please note that there may be effects that are not supported by all toolkits, or that provide different results with different toolkits.

    The effects that this module provides include:

    Effect name Description GD toolkit ImageMagick toolkit1
    Aspect switcher Choose image styles to apply based on source image orientation (portrait or landscape). X X
    Auto orientation Uses EXIF Orientation tags to determine the image orientation. X X
    Background Places the source image anywhere over a selected background image. X IM only
    Brightness Supports changing brightness settings of an image. Also supports negative values (darkening). X IM only
    Color shift Colorizes image. X IM only
    Contrast Supports changing contrast settings of an image. Also supports negative values. X IM only
    Convolution Allows to build custom image filters like blur, emboss, sharpen and others (see http://docs.gimp.org/en/plug-in-convmatrix.html). X IM only
    Gaussian blur Uses the Gaussian function to blur the image. X X
    ImageMagick arguments Directly enter ImageMagick command line arguments. X
    Interlace Used to specify the type of interlacing scheme for raw image formats. X IM only
    Invert Replace each pixel with its complementary color. X X
    Mask Apply a mask to the image. X IM only
    Mirror Mirror the image horizontally and/or vertically. X X
    Opacity Change overall image transparency level. X IM only
    Pixelate Pixelate the image. X X
    Relative crop Resize the image to match a ratio, for example 4:3 or 16:9. X X
    Resize percentage Resize the image by percentage of its width/height. X X
    Rotate Rotate the image by a specified angle, optionally setting the background color. Replacement for Drupal core's Rotate effect. X X
    Scale and Smart Crop Similar to Scale and Crop, but preserves the portion of the image with the most entropy. X X
    Set canvas Places the source image over a colored or a transparent background of a defined size. X IM only
    Set transparent color Defines the color to be used for transparency in GIF images. X IM only
    Smart Crop Similar to Crop, but preserves the portion of the image with the most entropy. X X
    Sharpen Sharpens an image (using convolution). X IM only
    Strip metadata Strips all EXIF metadata from image. X X
    Text overlay2 Overlays text on an image, defining text font, size and positioning. X IM only3
    Watermark Place a image with transparency anywhere over a source picture. X X4

    Notes:

    1 Effect support for ImageMagick also depends on the package in use, ImageMagick or GraphicsMagick. 'X' identifies effects that can be executed with both IM and GM, 'IM only' effects that can only be executed with ImageMagick.

    2 The Textimage module, if installed, allows this effect's configuration UI to present a preview of the text overlay.

    3 The ImageMagick toolkit actually requires the GD toolkit to build the text overlay.

    4 GraphicsMagick does not support setting transparency level (opacity) of the watermark image.

    What Image Effects is not?

    Image Effects does not provide a separate UI. It hooks into the Drupal core's image styles system. See Working with images in Drupal 7 and 8 for more information.

    Requirements

    1. Image module from Drupal core
    2. One of the supported image toolkits:

    Installing

    The module requires using Composer to manage Drupal site dependencies. Require the module via composer require drupal/image_effects:^3, then enable the module as usual.

    Configuration

    • Go to Manage > Configuration > Media > Image toolkit and configure your toolkit and its settings.
    • Check Image Effects configuration page (Manage > Configuration > Media > Image Effects), and choose the UI components that effects provided by this module should use:
      • Color selector - allows to specify a UI component to select colors in the image effects. It can use a 'color' HTML element, or a color picker provided by the Farbtastic library, or a JQuery Colorpicker (if the JQuery Colorpicker module is installed). Additional selectors may be added by other modules.
      • Image selector - some effects (e.g. Watermark) require to define an image file to be used. This setting allows to use either a basic text field where the URI/path to the image can be entered, or a 'dropdown' select that will list all the image files stored in a directory specified in configuration. Additional selectors may be added by other modules.
      • Font selector - some effects require to define a font file to be used. This setting allows to use either a basic text field where the URI/path to the font can be entered, or a 'dropdown' select that will list all the font files stored in a directory specified in configuration. Additional selectors may be added by other modules.

    Usage

    • Define image styles at Manage > Configuration > Media > Image styles and add one or more effects defined by this module.
    • Use the image styles via e.g. the formatters of image fields.

    Related modules

    • Use the Entity Clone module to make clones of image style configurations.
    • Install the JQuery Colorpicker module to allow using the JQuery Colorpicker widget to select colors in the image effects' configuration UI.

    Support

    File bugs, feature requests and support requests in the Drupal.org issue queue of this project.

    A note about the origin of this module

    This module is the Drupal 8 successor of the ImageCache Actions module. It also incorporates image effects that were part of the Drupal 7 versions of the ImageMagick, Textimage, FiltersIE, Smart Crop and ImageMagick Raw Effect modules.

    Which toolkit to use?

    ImageMagick toolkit comes with few advantages:

    • It is better in anti-aliasing. Try to rotate an image using both toolkits and you will see for yourself.
    • It does not execute in the PHP memory space, so is not restricted by the memory_limit PHP setting.
    • The GD toolkit will, at least on Windows configurations, keep the font file open after a text operation, so you cannot delete, move or rename it until PHP process is running.

    Advantages of GD toolkit on the other hand:

    • GD is always available, whereas ImageMagick is not always present on shared hosting or may be present in an antique version that might give problems.
    • Simpler architecture stack.

    Please also note that effects may give different results depending on the toolkit used.

    Developing

    Contributions to the module are welcome! Please read carefully the DEVELOPING.md file for developers' instructions.

    Maintainers

    Current and past maintainers for Image Effects:

    Past maintainers for Imagecache Actions: