CakePHP image upload component
If you have another point to improve, please comment or answer, I will change the accepted answer


To change the require I use the composer.json classmap like this (follow this answer: Import Class without autoload and repository):

"autoload": {
    "classmap": [
        "./vendor/CakePHP-ImageTool-Component"
    ]
}


I don't use require now.

In saveFileLFS method now I'm using Exception if something don't work.

public function saveFileLFS($stringSeparator, $storeName, $productName)
{
    $key = $storeName . $stringSeparator . $productName . $stringSeparator .
        $this-&gt;request-&gt;data['Media']['file']['name'];
    if(!StorageManager::adapter('Local')-&gt;write($key,
        file_get_contents($this-&gt;request-&gt;data['Media']['file']['tmp_name']))){
        throw new MissingHelperException();
        //Or other Exception
    }
}