HomeServiceContact
Drupal
min read
October 8, 2021
October 25, 2016

New Module - CSSgram recreating Instagram like filters for Drupal 8

New Module - CSSgram recreating Instagram like filters for Drupal 8
Table of contents

CSSgram module supplements Drupal Image styling experience by making Instagram like filters available to your Drupal 8 site images, we do this with help of CSSgram library. 

Beauty of this module is, it simply uses css to beautify your image.

cssgram-filters-sample

Few CSSGram sample filters applied to an image.

How CSSGram Module works?

CSSGram module uses CSSGram Library for adding filter effects via CSS to the image fields. Module extends Field Formatter Settings to add image filter for that particular field. CSSGram extends field formatter settings and hence these filters can be applied on top of the existing available image formatters and image presets. Allowing you to use your desired image preset along with CSSGram filters.

Using CSSGram

  1. Download and enable CSSGram module (https://www.drupal.org/project/cssgram)
  2. Visit Manage Display of content type and for the desired image field, click on the setting link under format column.
  3. Select Filter option lets us choose from the available image filters. Just select the desired image filter and hit update button.
third-party-settings-cssgram
  1. Save the settings and visit the content display page.

Developer Support

Devs have the option to use these filters anywhere on the site by just attaching the ‘cssgram/cssgram’ library and then applying any of the available css filter class to the wrapper element.


function mymodule_preprocess_field(&$variables) {
    // Add desired css class.
    $variables['attributes']['class'] = 'kelvin';
    // Attach cssgram library.
    $variables['#attached']['library'][] = 'cssgram/cssgram';
}
Written by
Editor
No art workers.
We'd love to talk about your business objectives