Add-on Documentation from JCOGS Design

UsageLast updated: 8 May 2024

JCOGS Image is a powerful image processing utility. 

Basic usage

In its simplest use, JCOGS Image creates correctly formed HTML <img> tags within your template; all you need to do is provide the tag with a path to an image source. 

The image source can be one of:

  • a URL provided by EE Files field variable (or the equivalent from an add-on such as Assets or Channel Images);
  • a path to file stored in or below the webroot folder of the server upon which EE is running;
  • a URL for a file in a remote location; or 
  • a copy of the database string entry used to store the file record within the EE database. 

The image needs to be in a supported format.

For example, if a file called cats.jpg obtained from a channel with a file field called images then the JCOGS Image tag:

{exp:jcogs_img:image src="{images}" }

will generate an HTML <img> tag like this:

<img src="/images/jcogs_img/cache/cats_-_28de80_-_09beb37dfb08841ba81890d5f23afca1042d281b.jpg">.

Typical usage

The utility of JCOGS Image is unlocked by adding one or more of the many possible parameters and / or filters to the JCOGS Image tag. By adding parameter and filter instructions you can instruct the add-on to modify your image before generating the <img> tag for you (for example, cropping, rotating, adding a watermark, or recolouring), and / or trigger advanced image features such as automatic lazy loading of your images, auto-sharpening, or the generation of srcset attributes for your <img> tag. 

For more complex / advanced situations you can alternatively use a tag-pair and JCOGS Image's template variables to build a customised <img> or <picture> tag, or use a bulk processing tag to apply the same image transformations to all the images within a template block - which, for example, is useful for normalising all the images within a Rich Text field.

JCOGS Image creates local copies of the images it generates, and has an advanced caching system that helps you avoid the need to redo the transformation steps each time a template is viewed.

Advanced usage

For advanced developers JCOGS Image also provides a range of tag syntax options to accommodate different / complex  template layout conditions, for example allowing you to mix multiple tags within the same template, and to nest tags to allow multiple transformations to be applied sequentially to a single image.

Image / Single Tag

The most common form of template tag used: all the parameters required to identify the source image and the manipulations and transformations required are included within the tag itself. 

To avoid any parsing confusion within the EE parse system, JCOGS Image single tags can use either image or single as the opening / closing tag element as required.






{exp:jcogs_img:image width='300px' save_type='webp' aspect_ratio='16_9' crop='y' max='400' class='kittens' add_dims="yes" flip='v'}

The example tag given above will generate the image shown, via this HTML img tag:

<img src="" class="kittens" width="300" height="168">

Note that options chosen for the JCOGS Image tag parameters have resulted in output from the tag which comprises: 

  • a well formed HTML img tag
  • the img tag includes image dimensions
  • the img tag includes the attribute class='kittens'

Also, the chosen JCOGS Image parameters have resulted in the image referenced in the img tag being:

  • a cached copy of a local image file which in turn is a modified version of the source file
  • cropped to give version of the original image shrunk to 300px wide
  • with a 16x9 aspect ratio
  • an image content which is the source image flipped vertically, and
  • saved in the webp format.

JCOGS Image's default 'smart scale' crop means the image height has was reduced to maintian the requested 16x9 aspect ratio (over-riding both the height and max parameters included in the example).

Usage Notes

JCOGS Image tags can use several method names.

  • {exp:jcogs_img:image}
  • {exp:jcogs_img:single} and
  • {exp:jcogs_img:pair}

are each aliases of the same method, and each can be used as either a single tag or as a tag-pair.  

This name duplication is provided partly to provide better compatibility with CE Image tag naming converntions, and partly to offer developers ways to circumvent EE tag name parsing clashes. 

Pair tag

JCOGS Image can also be accessed via the tag-pair form where a tag has an opening element (similar to the single-tag form described above) and also a closing element. Information can be passed to the add-on both from parameters placed within the opening tag and from the information enclosed between the opening and closing tag elements.

When a closing tag is defined JCOGS Image will process any parameters specified in the opening tag and replace any Image variables specified within the enclosed content with information relevant to the processed image. This approach allows you to create your own customised HTML output, and is particularly useful for creating the image content required by complex HTML image tags such as <figure> and <picture>.

For example:

    <img src="{made}" {attributes}="" width="{width}" height="{height}">
    <figcaption>This picture is called {name}.{extension}</figcaption>

will generate this HTML output:

<figure> <img src="/media/jcogs_img/tag_pair_demo_c_52eef17e88ec6541ff432ac461a62cb9a1596628.webp" class="cats" width="723" height="888"> <figcaption>This picture is called tag_pair_demo.webp</figcaption> </figure>


And this picture:

This picture is called tag_pair_demo.webp


Note: the dimensions reported for the processed image are not those specified in the opening tag - this is because of the rotation, and the width / height reported in the img tag are the dimensions required for the bounding box such that the rotated image can be placed on the page without distortion.

As is the case with single tag version of JCOGS Image, tag pairs can use any of  image single or pair as the method name in the opening / closing tag element as required.


{exp:jcogs_img:pair} ... {/exp:jcogs_img:pair}

{exp:jcogs_img:image} … {/exp:jcogs_img:image}

{exp:jcogs_img:single} … {/exp:jcogs_img:single}

Bulk Tag

Sometimes developers have to design templates to work with blocks of content that may contain one or more images added by content editors: the JCOGS Image bulk tag offers a way to apply some image processing to these images to (for example) ensure that they are optimally sized and in the ideal image format.

The bulk tag uses the tag-pair format, and searchs the template content enclosed by its opening / closing tags for <img> tags; any tags found are processed by JCOGS Image using the parameters found in the opening bulk tag. 

The bulk tag is most often used to apply 'standard' modifications to all the images within a content block (e.g. making all the images the same size / aspect ratio, applying a standard filter to each, converting all to a preferred image format etc.). JCOGS Image's intelligent handling of class, style and pass-through attributes also makes it easy for the developer to add a range of attributes to the <img> tags - for example adding one or more classes or inline styles to each <img>, or adding implementation specific attributes (such as data-* attributes) or the inlining of javascript events (such as onclick=). 


{exp:jcogs_img:bulk} ... {/exp:jcogs_img:bulk}


For example:

    Macavity, Macavity, there’s no one like Macavity,
    There never was a Cat of such deceitfulness and suavity.
<img src="{images}" width="700px">
    He always has an alibi, and one or two to spare:
    At whatever time the deed took place—MACAVITY WASN’T THERE!
    <img src="">

will generate HTML output like this:

<p>Macavity, Macavity, there’s no one like Macavity,
                    There never was a Cat of such deceitfulness and suavity.</p>
                <img src="/images/jcogs_img/cache/blackcatbeach_-_1f4_-_756febcb244c6154cd0d3540ea5cb3b794af4774.jpg" alt="cats">
                <p>He always has an alibi, and one or two to spare:
                    At whatever time the deed took place—MACAVITY WASN’T THERE!</p>
                <img src="/images/jcogs_img/cache/photo-1620196244888-d31ff5bbf163_-_1f4_-_756febcb244c6154cd0d3540ea5cb3b794af4774.jpg" alt="cats">

This in turn will create output that looks like this: 

Usage Notes

Note the example illustrates how bulk tag processing has processed and cached locally one local image (the first one in the example) and one image obtained from the web - JCOGS Image works equally well with either kind of image source.

Usage Notes

In general JCOGS Image will ignore any width or height parameters included in the enclosed <img> tags, any other parameters found will be added to the replacement image tag generated by JCOGS Image (i.e. passed through unchanged). Critical exceptions to this are how JCOGS Image handles any class or style parameters found - for these JCOGS Image will aggregate the entries generated by the Bulk tag (from the parameters given to it) and those found in the <img> tag - so the resulting <img> tag has at most one class= and one style= parameter entry.

Palette Tag

CE Image Compatibility: Partial

The palette pair type tag that gives you access to an analysis of the colours that appear in a processed image. It is broadly similar in function to the CE-Image ‘top_colors’ parameter.

The palette for the image is determined using a well regarded algorithm called Modified Median Cut Quantization. The maximum number of colours in the palette can be controlled through the palette_size parameter, which must be at least 2.

The tag supports some special variables:

  • {dominant_color} - the rgba() colour code for the image's dominant colour
  • {colors}…{/colors} - a variable pair that loops through the palette values identified for the image. The values exposed by this variable pair are:
    • {color} returns the rgb() color value of a palette colour
    • {rank} returns the ordinal rank of the palette colour (#1 being the dominant colour)



{exp:jcogs_img:palette src="" palette_size="<int>"} - default: palette_size=8

{exp:jcogs_img:palette src={images} palette_size="6"}



        {rank} - {color}



Size Tag

CE Image Compatibility: Full

The size tag is included for backward compatibility with early installations of CE Image.

The tag is a clone of the Image tag, and takes all the same parameters.




CE Image compatibility

JCOGS Image has strong compatibility with the stalwart CE Image add-on, offering developers a simpler upgrade path to EE5, EE6 and EE7 for sites developed using the CE-Img add-on.

Drop-in compatibility

Although JCOGS Image is based on a completely new image processing code base, it is possible to upgrade an existing site to JCOGS Image without loss of function simply doing a search / replace on the CE Image tag name - so for example {exp:ce_img:single...} would change to {exp:jcogs_img:single...}. In most cases the templates will generate output similar to that produced with CE Image.

Note: Some CE Image functions are not replicated (e.g. ASCIIart) and for some advanced uses (e.g. filters) there are some differences in how some settings work. Sections later in this document for more complete compatibility information.

CE Image Parameter Compatibility Table

Parameter CE Image Compatibility Notes
add_dimensions New feature
add_dims Full
allow_scale_larger Full
ascii_art Not implemented Unlikely to be replicated.
aspect_ratio New feature
attributes Full
auto_cache N/A File caching is handled differently by JCOGS Image - see separate notes
auto_sharpen New feature
aws_auto_url Not implemented Could be implemented in a future version if demand for this exists
bg_color Full
bg_color_default Not implemented Currently available via Control Panel option. Could be replicated as a parameter if demand for this exists.
border Full Added in version 1.1
bucket Not implemented File caching is handled differently by JCOGS Image - see separate notes
cache New feature This parameter allows the cache setting for an image to be set at the tag level.
cache_dir Full
consolidate_class_style New feature
create_tag Full
crop Full JCOGS Image's implementation of crop includes additional features not present in the CE Image crop parameter.
debug Not implemented Deprecated in CE Image. Comprehensive debugging information available via Control Panel option.
default_img_width New feature
disable_browser_checks New feature
disable_xss_check Not implemented XSS checks on paths provided are not optional.
encode_urls N/A JCOGS Image uses a different approach to file names and so this is not needed
face_crop_margin New feature
face_detect_sensitivity New feature
fallback_src Full
filename Full
filename_prefix Full
filename_suffix Full
filter Full Not all the filter options available in CE Image are currently implemented, see separate notes on this in the Filters section of this document.
flip Full
force_remote N/A This behaviour is handled automatically, there is no equivalent operation
hash_filename Full
height Full
hide_relative_path N/A JCOGS Image uses a different approach to file names and paths and so this is not needed
image_path_prefix New feature
interlace Full
lazy New feature Implements automatic lazy-loading for tags generated by the add-on.
manipulate Not implemented Could be replicated if demand for this exists
max Full
max_height Full
max_width Full
min Full
min_height Full
min_width Full
output Full
overwrite_cache Full
png_quality New feature
quality Full
reflection Full
remote_cache_time N/A File caching is handled differently by JCOGS Image - see separate notes
remote_dir N/A File caching is handled differently by JCOGS Image - see separate notes
rotate Full
rounded_corners Partial Added in version 1.3. Separately specified colour backgrounds for each corner for non-transparent image formats not supported.
save_type Full
src Full
srcset New feature Automatically add responsive variants of the processed image to an <img> tag via the srcset= and sizes= parameters
svg_passthrough New feature
text Full Added in version 1.1
top_colors Partial A broadly similar output is provided by JCOGS Image's palette method.
unique N/A File caching is handled differently by JCOGS Image - see separate notes
url_only Full
use_image_path_prefix New feature
watermark Full Added in version 1.1
width Full

CE Image Filter Compatibility Table

Filter CE Image Compatibility Notes
auto_sharpen Full
blur New feature
brightness Full
colorize Full
contrast Full
dominant_color New feature
dot Full
edgedetect Full
emboss Full
face_detect New feature
gaussian_blur Partial
grayscale Full
greyscale New feature
invert New feature
lqip New feature
mask New feature
mean_removal Full
negate Full
noise Full
opacity Full
pixelate Full
replace_colors Partial The filter is broadly equivalent in function to the replace_colors filter found in CE Image, but has slightly different parameters intended to simplify operations.
scatter Full
selective_blur Full
sepia Full The 'slow' version of the sepia filter is fully equivalent to the filter provided with CE Image, but takes about 5x longer to process an image than the 'fast' version (the default).
sharpen Full
smooth Full
sobel_edgify Partial Due to differences in the algorithm used to calculate the filtered image only the threshold sub-parameter is replicated: other sub-parameters will be ignored.

CE Image Variable Compatibility Table

Variable CE Image Compatibility Notes
aspect_ratio New feature Added in version 1.1
aspect_ratio_orig New feature Added in version 1.1
attributes Full
average_color Full Added in version 1.3
base_64 Full
base_64_orig Full
dominant_color New feature Added in version 1.2
extension Full
extension_orig Full
filesize Full
filesize_bytes Full
filesize_bytes_orig Full
filesize_orig Full
height Full
height_orig Full
img_credit New feature Added in version 1.3
img_description New feature Added in version 1.3
img_location New feature Added in version 1.3
img_title New feature Added in version 1.3.10
lazy_image New feature Added in version 1.3
lqip New feature Added in version 1.2
made Full
made_url Full
made_with_prefix New feature
mime_type New feature
name Full
name_orig Full
orig Full
orig_url Full
path Full
path_orig Full
sizes_param New feature Added in version 1.3
srcset_param New feature Added in version 1.3
type Full
type_orig Full
width Full
width_orig Full