Embedding images is probably the most common use of the BeEmbedMedia Helper. You just have to pass the $object array corresponding to an image object to the helpers object() method.

This helper will generate cached versions of thumbnails (or other image transformations) of your images the first time you call object() method. Subsequent calls will use cached version and will be obviously much more fast.

Imagemagick or GD library

The thumbnails can be generated using Imagemagick as well as GD library. Imagemagick is preferred beacuse it consumes less memory and it's more speedy so the Helper will try to use it, anyway a fallback on GD is present. So at least the GD PHP module must be installed on your system.
Anyhow if you want to force the use of GD you would want override the default configuration option 

$config['media']['image']['preferImagemagick'] = true;

located in in bedita-app/bedita.ini.php setting it to false in bedita-app/bedita.cfg.php

Using BeEmbedMedia Helper

In the following examples we will refer to BEdita 3.2, and we will use the new Smarty 3 syntax for arrays.

The parameters that are used for image manipulation are:

longside, width and height

At least, one of this parameters is required for displaying an image, and the value must be an integer. If no parameters has specified, the default values ['image']['thumbWidth'] and ['image']['thumbHeight'] in bedita.ini.php will be used. The longside parameter specifies that the longest side of the image will be resized at the specified size and the helper automatically ignores the other two parameters.
Otherwise width and height are used to resize the image in the canonical way but if only one dimension is used, the mode param will be forced to resize.

mode and modeparam

When we want to display thumbnails, we will write something like:

{$beEmbedMedia->object($media, ['width'=>200, 
  'height'=>200, 'mode'=>'crop'])}

The mode param specifies the type of scaling applied to the image. It's not mandatory, if not specified default bedita.ini.php parameter ['image']['thumbMode'] is used.
In the case above, the output result is:

simple crop

where the image was resized proportionally with the main side of 200px.
Other mode valid parameter type are: croponly and resize as displayed below.

modeparam parameter is optional and depends on which mode is specified. If the mode is croponly then we can specify the starting point for the zone to crop of the image with a string: 'C', 'T', 'B', 'L', 'R', 'TL', 'TR', 'BL', 'BR' .
For example, the code:

{$beEmbedMedia->object($media, [ 'width'=>300, 'height'=>300, 
 'mode'=>'croponly', 'modeparam'=>'BL' ] )}

generates the following images, cropped from the Bottom-Left angle:

croponly BL

As long as the code:

{$beEmbedMedia->object($media, ['width'=>300, 'height'=>300, 
 'mode'=>'croponly', 'modeparam'=>'TR'] )}

generates the following image, cropped from the Top-Right angle:

croponly TR

If mode is set on resize, then we can specify the type of resize with the fill or stretch string in the modeparams parameter.
The following code:

{$beEmbedMedia->object($media, ['width'=>100, 'height'=>300, 
  'mode'=>'resize', 'modeparam'=>'stretch'] )}

 Will resize the image exactly to the dimension required:


Otherwise, using the fill options in the modeparam:

{$beEmbedMedia->object($media, ['width'=>400, 'height'=>100, 
'mode'=>'resize', 'modeparam'=>'fill', 'bgcolor'=>'CCCCCC' )}


Will resize the image proportionally, filling the remaining space with the color specified in the bgcolor param. Note that the bgcolor param is considered only with the mode="resize" modeparam="fill" combination.


The type param is used to force the output type of the image as gif or png or jpg.


It's a boolean parameter with the default bedita.ini.php ['image']['thumbUpscale'] that allows or not the upscaling of an image.