Skip to content
Snippets Groups Projects
Commit a0980064 authored by Oleksandr Karpenko's avatar Oleksandr Karpenko
Browse files

MAGETWO-51604: [TD] Add functionality to save image in custom folder

parent 03d43a6f
No related merge requests found
...@@ -114,19 +114,20 @@ class File extends BackendFile ...@@ -114,19 +114,20 @@ class File extends BackendFile
$value = $this->getValue(); $value = $this->getValue();
if ($value && !is_array($value)) { if ($value && !is_array($value)) {
$fileName = $this->_getUploadDir() . '/' . basename($value); $fileName = $this->_getUploadDir() . '/' . basename($value);
$fileInfo = []; $fileInfo = null;
if ($this->_mediaDirectory->isExist($fileName)) { if ($this->_mediaDirectory->isExist($fileName)) {
$stat = $this->_mediaDirectory->stat($fileName); $stat = $this->_mediaDirectory->stat($fileName);
$url = $this->getStoreMediaUrl($value); $url = $this->getStoreMediaUrl($value);
$fileInfo = [ $fileInfo = [
'url' => $url, [
'file' => $value, 'url' => $url,
'size' => is_array($stat) ? $stat['size'] : 0, 'file' => $value,
'exists' => true 'size' => is_array($stat) ? $stat['size'] : 0,
'exists' => true
]
]; ];
} }
$this->setValue([$fileInfo]); $this->setValue($fileInfo);
} }
return $this; return $this;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment