code: private function createConfig($size, ImageInterface $image): array
      {
          if (!\is_array($size)) {
              $size = [0, 0, $size];
          }
  
          $config = new ResizeConfiguration();
  
          if (isset($size[2]) && is_numeric($size[2])) {
              /** @var ImageSizeModel $imageModel */
              $imageModel = $this->framework->getAdapter(ImageSizeModel::class);
              $imageSize = $imageModel->findByPk($size[2]);
  
              if (null !== $imageSize) {
                  $config
                      ->setWidth($imageSize->width)
                      ->setHeight($imageSize->height)
                      ->setMode($imageSize->resizeMode)
                      ->setZoomLevel($imageSize->zoom)
                  ;
              }
  
              return [$config, null];
          }
  
          if (!empty($size[0])) {
              $config->setWidth($size[0]);
          }
          if (!empty($size[1])) {
              $config->setHeight($size[1]);
          }
  
          if (!isset($size[2]) || 1 !== substr_count($size[2], '_')) {
              if (!empty($size[2])) {
                  $config->setMode($size[2]);
              }
  
              return [$config, null];
          }
  
          $config->setMode(ResizeConfigurationInterface::MODE_CROP);
  
          return [$config, $this->getImportantPartFromLegacyMode($image, $size[2])];
      }
docs: Creates a resize configuration object.
  
  @param int|array|null $size An image size or an array with width, height and resize mode
  
  @return (ResizeConfigurationInterface|ImportantPartInterface|null)[]