protected function compileImages($offset, $limit): array
    {
        $lightBoxId = 'lightbox[lb' . $this->get('id') . ']';
        $body       = [];

        $imageSizes = StringUtil::deserialize($this->get('bs_image_sizes'), true);

        for ($index = $offset; $index < $limit; $index++) {
            if (!isset($this->images[$index])) {
                break;
            }

            $cell        = new \stdClass();
            $cell->class = 'image_' . $index;

            // Loop through images sizes.
            $size = current($imageSizes);
            if (next($imageSizes) === false) {
                reset($imageSizes);
            }

            // Build legacy size format.
            if (is_array($size)) {
                $size = [$size['width'], $size['height'], $size['size']];
            }

            // Add size and margin
            $this->images[$index]['size']     = $size;
            $this->images[$index]['fullsize'] = $this->get('fullsize');

            Controller::addImageToTemplate(
                $cell,
                $this->images[$index],
                null,
                $lightBoxId,
                $this->images[$index]['filesModel']
            );

            $cell->picture['attributes'] = 'class="img-fluid figure-img img-thumbnail"';

            $body[] = $cell;
        }

        return $body;
    }