Generates and calls the correct method for the generation method used in preset

@return mixed
FALSE if no matching method, otherwise the Image Object
333319
protected function buildImage () {
    $method = 'buildImage'. ucfirst($this->preset->method);
    if (method_exists($this, $method)) {
      return $this->{$method}();
    }

    return FALSE;
  }
789126
public function newPreset() {
		$name = esc_html($_POST['name']);
		if(empty($name)) {
			json_response([
				              'status' => 'error',
				              'error' => 'Seems that you may have forgotten something.'
			              ]);
		}

		$key = sanitize_title($name);
		$newKey = $key;

		$presets = get_option('ilab-imgix-presets');
		if($presets) {
			$keyIndex = 1;
			while(isset($presets[$newKey])) {
				$keyIndex ++;
				$newKey = $key.$keyIndex;
			}
		}

		$settings = $_POST['settings'];
		$size = (isset($_POST['size'])) ? esc_html($_POST['size']) : null;
		$makeDefault = (isset($_POST['make_default'])) ? ($_POST['make_default'] == 1) : false;

		$this->doUpdatePresets($newKey, $name, $settings, $size, $makeDefault);

	}
418770
public function generate()
	{
		$this->strTemplate = $this->customTpl ?: $this->type;

		// Return output for the backend if in BE mode
		if (($output = $this->rsceGetBackendOutput()) !== null) {
			return $output;
		}

		try {
			return parent::generate();
		}
		catch (\Exception $exception) {

			if (TL_MODE === 'BE') {

				$template = new CustomTemplate($this->strTemplate);
				$template->setData($this->Template->getData());
				$this->Template = $template;

				return $this->Template->parse();

			}

			throw $exception;
		}
	}
1321849
protected function buildImageResize() {
    $image = Image::make($this->upload_path . $this->file_name)->orientate();

    $image->resize($this->preset->width, $this->preset->height , function ($constraint) {
      $constraint->aspectRatio();
      $constraint->upsize();
    });

    //if background_color is not set, do not resizeCanvas with black color, to avoid black zones in images. 
    if(isset($this->preset->background_color))
    {
      $image->resizeCanvas($this->preset->width, $this->preset->height, 'center', FALSE, $this->preset->background_color);
    }
    
    return $image;
  }
826315
private function createImagineInstance()
    {
        $extension = mb_strtolower(\Craft::$app->getConfig()->getGeneral()->imageDriver);
        
        try {
            if ($extension === 'gd') {
                return new \Imagine\Gd\Imagine();
            }

            if ($extension === 'imagick') {
                return new \Imagine\Imagick\Imagine();
            }
        } catch (RuntimeException $e) {
            // just ignore for now
        }

        return null;
    }
924509
public function generateData()
    {
        foreach ($this->fireMethods as $method) {
            $this->log(
                "Calling function \"{$method}\": Actual memory usage before method: " .
                $this->getMemoryUsageString(),
                ShopgateLogger::LOGTYPE_DEBUG
            );
            $this->{$method}();
        }

        return $this;
    }
869419
final private function __setDataFromMethods()
    {
        // Get all public methods from class
        $this->methods = $this->class->getMethods(\ReflectionMethod::IS_PUBLIC);

        // Remove __contruct, __init, __finalize and this class methods from $this->methods
        $this->methods = array_filter($this->methods, function ($method) {
            return
                $method->class !== 'Sober\Controller\Controller' &&
                $method->name !== '__construct' &&
                $method->name !== '__before' &&
                $method->name !== '__after';
        });

        // Get all public static methods from class
        $this->staticMethods = $this->class->getMethods(\ReflectionMethod::IS_STATIC);

        // Remove $this->staticMethods from $this->methods using array_diff
        $this->dataMethods = array_diff($this->methods, $this->staticMethods);

        // Filter the remaining data methods
        $this->dataMethods = array_filter($this->dataMethods, function ($method) {
            return $method = $method->name;
        });

        // For each method convert method name to snake case and add to data[key => value]
        foreach ($this->dataMethods as $method) {
            // Convert method name to snake case
            $var = Utils::convertToSnakeCase($method->name);

            // Add var method name to data[]
            $this->data[$var] = $this->{$method->name}();
        }
    }
66134
protected function generate_cached_image() {
    $cached_image = $this->get_cached_image_path();

    if (file_exists($cached_image)) {
      return TRUE;
    }

    $path_info = pathinfo($cached_image);

    if (!is_dir($path_info['dirname'])) {
      mkdir($path_info['dirname'], 0777, TRUE);
    }

    if (!($image = $this->buildImage())) {
      return FALSE;
    }

    if ($image->save($cached_image, $this->quality)) {
      return TRUE;
    }

    return FALSE;
  }
831541
public function generate_class()
    {

        /**
         * generates the spaces
         *
         * @param int $amount
         *
         * @return string
         */
        function gen_spaces($amount)
        {
            $spaces = '';
            for ($i = 0; $i < $amount; $i++) {
                $spaces .= ' ';
            }

            return $spaces;
        }

        if (empty($this->table_model)) {
            return false;
        }

        // general initiation of the object properties based on the
        $this->init();

        $this->generate_class_definition();
        if (strpos($this->class_name, '_') !== false) {
            $tmp = explode('_', $this->class_name);
            foreach ($tmp as $key => $part) {
                $tmp[$key] = ucfirst(strtolower($part));
            }
            $this->class_name = implode('_', $tmp);
        }

        $this->tpl_replacements['class_name'] = $this->class_name;
        $file                                 = new File();
        $file->open($this->tpl_path);

        $this->generated_code = $file->read();

        foreach ($this->tpl_replacements as $pattern => $value) {
            if (!is_string($value)) continue;

            $pattern              = '#' . strtoupper($pattern) . '#';
            $this->generated_code = str_replace($pattern, $value, $this->generated_code);
        }

        $this->generated_code = str_replace("\t", gen_spaces(self::SPACE_AMOUNT), $this->generated_code);

        return true;
    }
303822
public function generate()
    {
        $code = '';

        if ($this->type !== null) {
            $code .= $this->type . ' ';
        }

        if ($this->passByReference === true) {
            $code .= '&';
        }

        $code .= '$' . $this->name;

        if ($this->defaultValue !== null) {
            if ($this->isDefaultValueConstant() === true) {
                $code .= ' = ' . $this->getDefaultValueConstantName();
            } else {
                $this->defaultValue->setOutputMode(ValueGenerator::OUTPUT_SINGLE_LINE);
                $code .= ' = ' . $this->defaultValue;
            }
        }

        return $code;
    }
1173624
public function getImage()
    {
        $code = $this->code->generate(
            $this->params['chars'],
            $this->params['length'][0],
            $this->params['length'][1]
        );

        $this->storage->push($code);

        return $this->generator->render($code, $this->params);
    }
169459
public function getDefaultImageLinked()
    {
        if ($method = $this->owner->ImageDefaultLinked) {
            return (boolean) $method;
        }
        
        if ($this->owner->hasExtension(MetaDataExtension::class)) {
            return $this->owner->getFieldFromParent('DefaultImageLinked');
        }
    }
1079135
private function generateModel()
    {
        $modelInstance = Model::instance($this);
        $modelTemplateDir =
            dirname(dirname(__FILE__)).DS.'src'.DS.ucfirst('apps').DS.ucfirst('models').DS;

        $modelInstance->setModelTemplatePath($modelTemplateDir);
        $modelInstance->updateTemplate();
        $modelInstance->generate();

        return true;
    }
1256341
public function generate()
	{
		if (TL_MODE === 'BE') {
			return parent::generate();
		}

		$classes = array('rs-column');
		$parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid'];

		if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) {

			$GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] = false;
			$GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++;

			$count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count'];
			foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) {
				$classes = array_merge($classes, $media[($count - 1) % count($media)]);
				if ($count - 1 < count($media)) {
					$classes[] = '-' . $name . '-first-row';
				}
			}

		}
		else {
			trigger_error('Missing column wrapper start element before column start element ID ' . $this->id . '.', E_USER_WARNING);
		}

		if (!is_array($this->cssID)) {
			$this->cssID = array('', '');
		}
		$this->arrData['cssID'][1] .= ' ' . implode(' ', $classes);

		return parent::generate();
	}
280483
public function get_block_render_method() {
        if ($this->blockrendermethod) {
            // Return the specified block render method.
            return $this->blockrendermethod;
        }
        // Its not explicitly set, check the parent theme configs.
        foreach ($this->parent_configs as $config) {
            if (isset($config->blockrendermethod)) {
                return $config->blockrendermethod;
            }
        }
        // Default it to blocks.
        return 'blocks';
    }
1095401
public function ModernoLoadingImageExists()
    {
        if ($image = $this->owner->ModernoLoadingImage()) {
            return ($image->exists() && file_exists($image->getFullPath()));
        }
        
        return false;
    }
1053750
public function generate()
	{
		if ($this->imageSubmit)
		{
			$objModel = \FilesModel::findByPk($this->singleSRC);

			if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path))
			{
				return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s" title="%s" alt="%s"%s>%s</button>',
					$this->strId,
					(($this->strClass != '') ? ' ' . $this->strClass : 'btn-default'),
					specialchars($this->slabel),
					specialchars($this->slabel),
					$this->getAttributes(),
					\Image::getHtml($objModel->path, $this->slabel)
				);
			}
		}

		$label = specialchars($this->slabel);

		if($this->bootstrap_addIcon) {
			$icon = Icons::generateIcon($this->bootstrap_icon);

			if($this->bootstrap_iconPosition == 'right') {
				$label = $label . ' ' . $icon;
			}
			else {
				$label = $icon  . ' ' . $label;
			}
		}

		// Return the regular button
		return sprintf('<button type="submit" id="ctrl_%s" class="submit btn %s"%s>%s</button>',
			$this->strId,
			(($this->strClass != '') ? $this->strClass : 'btn-default'),
			$this->getAttributes(),
			$label
		);
	}