Pimcore\Model\Asset\Image\Thumbnail\Config::getByLegacyConfig PHP Method

getByLegacyConfig() public static method

This is just for compatibility, this method will be removed with the next major release
public static getByLegacyConfig ( $config ) : self
$config
return self
    public static function getByLegacyConfig($config)
    {
        $pipe = new self();
        if (isset($config["format"])) {
            $pipe->setFormat($config["format"]);
        }
        if (isset($config["quality"])) {
            $pipe->setQuality($config["quality"]);
        }
        if (isset($config["cover"])) {
            $pipe->addItem("cover", ["width" => $config["width"], "height" => $config["height"], "positioning" => "center"]);
        } elseif (isset($config["contain"])) {
            $pipe->addItem("contain", ["width" => $config["width"], "height" => $config["height"]]);
        } elseif (isset($config["frame"])) {
            $pipe->addItem("frame", ["width" => $config["width"], "height" => $config["height"]]);
        } elseif (isset($config["aspectratio"]) && $config["aspectratio"]) {
            if (isset($config["height"]) && isset($config["width"]) && $config["height"] > 0 && $config["width"] > 0) {
                $pipe->addItem("contain", ["width" => $config["width"], "height" => $config["height"]]);
            } elseif (isset($config["height"]) && $config["height"] > 0) {
                $pipe->addItem("scaleByHeight", ["height" => $config["height"]]);
            } else {
                $pipe->addItem("scaleByWidth", ["width" => $config["width"]]);
            }
        } else {
            if (!isset($config["width"]) && isset($config["height"])) {
                $pipe->addItem("scaleByHeight", ["height" => $config["height"]]);
            } elseif (isset($config["width"]) && !isset($config["height"])) {
                $pipe->addItem("scaleByWidth", ["width" => $config["width"]]);
            } elseif (isset($config["width"]) && isset($config["height"])) {
                $pipe->addItem("resize", ["width" => $config["width"], "height" => $config["height"]]);
            }
        }
        if (isset($config["highResolution"])) {
            $pipe->setHighResolution($config["highResolution"]);
        }
        $hash = md5(Serialize::serialize($pipe));
        $pipe->setName("auto_" . $hash);
        return $pipe;
    }