Drupal 8 Contribution to Image Effects

Reading time: 3 minutes.

Last modified: 15 August 2016

Drupal 8.0 was released almost a year ago. We have created 3 sites on Drupal 8 during that time.

Many Drupal 8 contrib modules are not ready to use on production sites, they contain bugs and don’t have all the features as the same modules for Drupal 7. Do that is not a reason to despair, not to use these modules at all and to write custom code. We decided to write patches for additional features in required modules and to apply these patches to the modules.

Before

Mostly we didn’t have enough additional functionality for module Effects. Image Effects is a module continued module Imagecache Actions in Drupal 8. The module developers migrated the most functionality from Imagecache Actions to Image Effects, but some features are still not migrated, for example Interlace / Progressive effect.

Image effects: Interlace / Progressive

We think that Interlace must be applied to images in a large number of the sites. The user doesn’t have to wait while an image is fully loaded to see results:

Gif

Firstly it applies to big banners, which can change their own height and permanently change scroll bar position on the page. Also this effect looks good on sliders and carousels. We didn’t wait for this effect appeared in Image Effects module and we tried to add the effect.

In the beginning we created a separate module for Interlace / Progressive effect.

But this effect can be used on many sites, so we decided to add it to Image Effects module. We created a patch and uploaded it on drupal.org:

https://www.drupal.org/node/2751175

The effect worked fine, but all the functionality needs testing. We had a trouble with it. Effects work with two different image toolkits GD2 и Imagemagick. But Drupal.org CI uses only GD2 for testing. So our test worked with Imagemagick:

identify -verbose

and we were needed to rewrite it. Some plain PHP code helped us to rewrite tests. So our tests were rewritten and the patch was successfully applied to Image Effects 8.x-1.x module. You can use it starting Image Effects 8.x-1.0-alpha3 version or use dev-version of module 8.x-1.x-dev.

Image Effects: Perspective

Perspective is another effect which is absent in Imagecache Actions and Image effect. It looks like that:
Before:

Before

After:

After

Perspective effect provides wide settings form. You can use this effect to create symmetric perspective and asymmetric perspective. Also you can choose direction and distortion for a new image.

We are working on a patch for Image Effects:

https://www.drupal.org/node/2762627

and for Imagecache Actions:

https://www.drupal.org/node/2760121

We’ve written some tests which show the effect works correctly. Perspective effect will soon become available in modules Image Effects and Imagecache Actions soon.

Drupal 8 increases your power with new modules, adding new functionality, fixing bugs. You make Drupal 8 sites development faster and painless to take part in contribution for Drupal 8 modules.