Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (\Magento\Backend\Model\Session $session, \Magento\Backend\Model\UrlInterface $backendUrl, \Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages, \Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Image\AdapterFactory $imageFactory, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory $storageCollectionFactory, \Magento\MediaStorage\Model\File\Storage\FileFactory $storageFileFactory, \Magento\MediaStorage\Model\File\Storage\DatabaseFactory $storageDatabaseFactory, \Magento\MediaStorage\Model\File\Storage\Directory\DatabaseFactory $directoryDatabaseFactory, \Magento\MediaStorage\Model\File\UploaderFactory $uploaderFactory, array $resizeParameters=[], array $extensions=[], array $dirs=[], array $data=[]) | |
getDirsCollection ($path) | |
createDirectory ($name, $path) | |
deleteDirectory ($path) | |
deleteFile ($target) | |
getThumbnailPath ($filePath, $checkFile=false) | |
getThumbnailUrl ($filePath, $checkFile=false) | |
resizeFile ($source, $keepRatio=true) | |
resizeOnTheFly ($filename) | |
getThumbsPath ($filePath=false) | |
getSession () | |
getAllowedExtensions ($type=null) | |
getThumbnailRoot () | |
isImage ($filename) | |
getResizeWidth () | |
getResizeHeight () | |
getCmsWysiwygImages () | |
![]() | |
__construct (array $data=[]) | |
addData (array $arr) | |
setData ($key, $value=null) | |
unsetData ($key=null) | |
getData ($key='', $index=null) | |
getDataByPath ($path) | |
getDataByKey ($key) | |
setDataUsingMethod ($key, $args=[]) | |
getDataUsingMethod ($key, $args=null) | |
hasData ($key='') | |
toArray (array $keys=[]) | |
convertToArray (array $keys=[]) | |
toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true) | |
toJson (array $keys=[]) | |
convertToJson (array $keys=[]) | |
toString ($format='') | |
__call ($method, $args) | |
isEmpty () | |
serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"') | |
debug ($data=null, &$objects=[]) | |
offsetSet ($offset, $value) | |
offsetExists ($offset) | |
offsetUnset ($offset) | |
offsetGet ($offset) | |
Data Fields | |
const | DIRECTORY_NAME_REGEXP = '/^[a-z0-9\-\_]+$/si' |
const | THUMBS_DIRECTORY_NAME = '.thumbs' |
const | THUMB_PLACEHOLDER_PATH_SUFFIX = 'Magento_Cms::images/placeholder_thumbnail.jpg' |
Protected Member Functions | |
getConditionsForExcludeDirs () | |
removeItemFromCollection ($collection, $conditions) | |
_deleteByPath ($path) | |
_validatePath ($path) | |
_sanitizePath ($path) | |
_getRelativePathToRoot ($path) | |
![]() | |
_getData ($key) | |
_underscore ($name) | |
Protected Attributes | |
$_config | |
$_configAsArray | |
$_directory | |
$_imageFactory | |
$_assetRepo | |
$_coreFileStorageDb = null | |
$_cmsWysiwygImages = null | |
$_resizeParameters | |
$_extensions | |
$_dirs | |
$_backendUrl | |
$_session | |
$_directoryDatabaseFactory | |
$_storageDatabaseFactory | |
$_storageFileFactory | |
$_storageCollectionFactory | |
$_uploaderFactory | |
![]() | |
$_data = [] | |
Additional Inherited Members | |
![]() | |
static | $_underscoreCache = [] |
@SuppressWarnings(PHPMD.LongVariable) @SuppressWarnings(PHPMD.TooManyFields) @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@api
Definition at line 21 of file Storage.php.
__construct | ( | \Magento\Backend\Model\Session | $session, |
\Magento\Backend\Model\UrlInterface | $backendUrl, | ||
\Magento\Cms\Helper\Wysiwyg\Images | $cmsWysiwygImages, | ||
\Magento\MediaStorage\Helper\File\Storage\Database | $coreFileStorageDb, | ||
\Magento\Framework\Filesystem | $filesystem, | ||
\Magento\Framework\Image\AdapterFactory | $imageFactory, | ||
\Magento\Framework\View\Asset\Repository | $assetRepo, | ||
\Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory | $storageCollectionFactory, | ||
\Magento\MediaStorage\Model\File\Storage\FileFactory | $storageFileFactory, | ||
\Magento\MediaStorage\Model\File\Storage\DatabaseFactory | $storageDatabaseFactory, | ||
\Magento\MediaStorage\Model\File\Storage\Directory\DatabaseFactory | $directoryDatabaseFactory, | ||
\Magento\MediaStorage\Model\File\UploaderFactory | $uploaderFactory, | ||
array | $resizeParameters = [] , |
||
array | $extensions = [] , |
||
array | $dirs = [] , |
||
array | $data = [] |
||
) |
Construct
\Magento\Backend\Model\Session | $session | |
\Magento\Backend\Model\UrlInterface | $backendUrl | |
\Magento\Cms\Helper\Wysiwyg\Images | $cmsWysiwygImages | |
\Magento\MediaStorage\Helper\File\Storage\Database | $coreFileStorageDb | |
\Magento\Framework\Filesystem | $filesystem | |
\Magento\Framework\Image\AdapterFactory | $imageFactory | |
\Magento\Framework\View\Asset\Repository | $assetRepo | |
\Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory | $storageCollectionFactory | |
\Magento\MediaStorage\Model\File\Storage\FileFactory | $storageFileFactory | |
\Magento\MediaStorage\Model\File\Storage\DatabaseFactory | $storageDatabaseFactory | |
\Magento\MediaStorage\Model\File\Storage\Directory\DatabaseFactory | $directoryDatabaseFactory | |
\Magento\MediaStorage\Model\File\UploaderFactory | $uploaderFactory | |
array | $resizeParameters | |
array | $extensions | |
array | $dirs | |
array | $data | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 154 of file Storage.php.
|
protected |
Delete by path
string | $path |
Definition at line 440 of file Storage.php.
|
protected |
Get path in root storage dir
string | $path |
Definition at line 742 of file Storage.php.
|
protected |
Sanitize path
string | $path |
Definition at line 731 of file Storage.php.
|
protected |
Is path under storage root directory
string | $path |
Definition at line 710 of file Storage.php.
createDirectory | ( | $name, | |
$path | |||
) |
Create new directory in storage
string | $name | New directory name |
string | $path | Parent directory path |
Definition at line 373 of file Storage.php.
deleteDirectory | ( | $path | ) |
Recursively delete directory from storage
string | $path | Target dir |
Definition at line 420 of file Storage.php.
deleteFile | ( | $target | ) |
Delete file (and its thumbnail if exists) from storage
string | $target | File path to be deleted |
Definition at line 455 of file Storage.php.
getAllowedExtensions | ( | $type = null | ) |
Prepare allowed_extensions config settings
string | $type | Type of storage, e.g. image, media etc. |
Definition at line 641 of file Storage.php.
getCmsWysiwygImages | ( | ) |
Get cms wysiwyg images helper
Definition at line 698 of file Storage.php.
|
protected |
Prepare and get conditions for exclude directories
Definition at line 214 of file Storage.php.
getDirsCollection | ( | $path | ) |
Return one-level child directories for specified path
string | $path | Parent directory path |
Definition at line 266 of file Storage.php.
getResizeHeight | ( | ) |
getResizeWidth | ( | ) |
getSession | ( | ) |
getThumbnailPath | ( | $filePath, | |
$checkFile = false |
|||
) |
Thumbnail path getter
string | $filePath | original file path |
bool | $checkFile | OPTIONAL is it necessary to check file availability |
Definition at line 514 of file Storage.php.
getThumbnailRoot | ( | ) |
Thumbnail root directory getter
Definition at line 653 of file Storage.php.
getThumbnailUrl | ( | $filePath, | |
$checkFile = false |
|||
) |
Thumbnail URL getter
string | $filePath | original file path |
bool | $checkFile | OPTIONAL is it necessary to check file availability |
Definition at line 536 of file Storage.php.
getThumbsPath | ( | $filePath = false | ) |
Return thumbnails directory path for file/current directory
bool | string | $filePath | Path to the file |
Definition at line 613 of file Storage.php.
isImage | ( | $filename | ) |
Simple way to check whether file is image or not based on extension
string | $filename |
Definition at line 664 of file Storage.php.
|
protected |
Remove excluded directories from collection
\Magento\Framework\Data\Collection\Filesystem | $collection | |
array | $conditions |
Definition at line 241 of file Storage.php.
resizeFile | ( | $source, | |
$keepRatio = true |
|||
) |
Create thumbnail for image and save it to thumbnails directory
string | $source | Image path to be resized |
bool | $keepRatio | Keep aspect ratio or not |
Definition at line 565 of file Storage.php.
resizeOnTheFly | ( | $filename | ) |
Resize images on the fly in controller action
string | $filename | File basename |
Definition at line 598 of file Storage.php.
|
protected |
Definition at line 56 of file Storage.php.
|
protected |
Definition at line 90 of file Storage.php.
|
protected |
Definition at line 70 of file Storage.php.
|
protected |
Definition at line 34 of file Storage.php.
|
protected |
Definition at line 41 of file Storage.php.
|
protected |
Definition at line 63 of file Storage.php.
|
protected |
Definition at line 46 of file Storage.php.
|
protected |
Definition at line 102 of file Storage.php.
|
protected |
Definition at line 85 of file Storage.php.
|
protected |
Definition at line 80 of file Storage.php.
|
protected |
Definition at line 51 of file Storage.php.
|
protected |
Definition at line 75 of file Storage.php.
|
protected |
Definition at line 95 of file Storage.php.
|
protected |
Definition at line 123 of file Storage.php.
|
protected |
Definition at line 109 of file Storage.php.
|
protected |
Definition at line 116 of file Storage.php.
|
protected |
Definition at line 130 of file Storage.php.
const DIRECTORY_NAME_REGEXP = '/^[a-z0-9\-\_]+$/si' |
Definition at line 23 of file Storage.php.
const THUMB_PLACEHOLDER_PATH_SUFFIX = 'Magento_Cms::images/placeholder_thumbnail.jpg' |
Definition at line 27 of file Storage.php.
const THUMBS_DIRECTORY_NAME = '.thumbs' |
Definition at line 25 of file Storage.php.