예제 #1
0
파일: Storage.php 프로젝트: aiesh/magento2
 /**
  * Get files collection
  *
  * @return array
  */
 public function getFilesCollection()
 {
     $paths = $this->mediaWriteDirectory->search('.*', $this->_helper->getCurrentPath());
     $files = array();
     $requestParams = $this->_helper->getRequestParams();
     $storageType = $this->_helper->getStorageType();
     foreach ($paths as $path) {
         if (!$this->mediaWriteDirectory->isFile($path)) {
             continue;
         }
         $fileName = pathinfo($path, PATHINFO_BASENAME);
         $file = array('text' => $fileName, 'id' => $this->_helper->urlEncode($fileName));
         if (self::TYPE_IMAGE == $storageType) {
             $requestParams['file'] = $fileName;
             $file['thumbnailParams'] = $requestParams;
             $size = @getimagesize($path);
             if (is_array($size)) {
                 $file['width'] = $size[0];
                 $file['height'] = $size[1];
             }
         }
         $files[] = $file;
     }
     return $files;
 }
예제 #2
0
파일: Tree.php 프로젝트: aiesh/magento2
 /**
  * Return tree node full path based on current path
  *
  * @return string
  */
 public function getTreeCurrentPath()
 {
     $treePath = '/root';
     $path = $this->_storageHelper->getSession()->getCurrentPath();
     if ($path) {
         $path = str_replace($this->_storageHelper->getStorageRoot(), '', $path);
         $relative = '';
         foreach (explode('/', $path) as $dirName) {
             if ($dirName) {
                 $relative .= '/' . $dirName;
                 $treePath .= '/' . $this->_storageHelper->urlEncode($relative);
             }
         }
     }
     return $treePath;
 }