47 public function create($adapterAlias =
null)
50 $adapterAlias = !empty($adapterAlias) ? $adapterAlias : $this->config->getAdapterAlias();
51 if (empty($adapterAlias)) {
52 throw new \InvalidArgumentException(
'Image adapter is not selected.');
54 if (empty($this->adapterMap[$adapterAlias][
'class'])) {
55 throw new \InvalidArgumentException(
"Image adapter for '{$adapterAlias}' is not setup.");
57 $imageAdapter = $this->objectManager->create($this->adapterMap[$adapterAlias][
'class']);
58 if (!$imageAdapter instanceof Adapter\AdapterInterface) {
59 throw new \InvalidArgumentException(
60 $this->adapterMap[$adapterAlias][
'class'] .
61 ' is not instance of \Magento\Framework\Image\Adapter\AdapterInterface' 64 $imageAdapter->checkDependencies();
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\Image\Adapter\ConfigInterface $config, array $adapterMap=[])
create($adapterAlias=null)