protected function initLibraryItem($path, $itemType)
    {
        $relativePath = $this->getMediaRelativePath($path);

        if (!$this->isVisible($relativePath)) {
            return;
        }

        /*
         * S3 doesn't allow getting the last modified timestamp for folders,
         * so this feature is disabled - folders timestamp is always NULL.
         */
        $lastModified = $itemType == MediaLibraryItem::TYPE_FILE
            ? $this->getStorageDisk()->lastModified($path)
            : null;

        /*
         * The folder size (number of items) doesn't respect filters. That
         * could be confusing for users, but that's safer than displaying
         * zero items for a folder that contains files not visible with a
         * currently applied filter. -ab
         */
        $size = $itemType == MediaLibraryItem::TYPE_FILE
            ? $this->getStorageDisk()->size($path)
            : $this->getFolderItemCount($path);

        $publicUrl = $this->getPathUrl($relativePath);

        return new MediaLibraryItem($relativePath, $size, $lastModified, $itemType, $publicUrl);
    }
protected function initLibraryItem($path, $itemType)
    {
        $relativePath = $this->getMediaRelativePath($path);

        if (!$this->isVisible($relativePath)) {
            return;
        }

        /*
         * S3 doesn't allow getting the last modified timestamp for folders,
         * so this feature is disabled - folders timestamp is always NULL.
         */
        $lastModified = $itemType == MediaLibraryItem::TYPE_FILE
            ? $this->getStorageDisk()->lastModified($path)
            : null;

        /*
         * The folder size (number of items) doesn't respect filters. That
         * could be confusing for users, but that's safer than displaying
         * zero items for a folder that contains files not visible with a
         * currently applied filter. -ab
         */
        $size = $itemType == MediaLibraryItem::TYPE_FILE
            ? $this->getStorageDisk()->size($path)
            : $this->getFolderItemCount($path);

        $publicUrl = $this->getPathUrl($relativePath);

        return new MediaLibraryItem($relativePath, $size, $lastModified, $itemType, $publicUrl);
    }
protected function initLibraryItem ( $ path , $ itemType ) { $ relativePath = $ this -> getMediaRelativePath ( $ path ) ; if ( ! $ this -> isVisible ( $ relativePath ) ) { return ; } /*
         * S3 doesn't allow getting the last modified timestamp for folders,
         * so this feature is disabled - folders timestamp is always NULL.
         */ $ lastModified = $ itemType == MediaLibraryItem :: TYPE_FILE ? $ this -> getStorageDisk ( ) -> lastModified ( $ path ) : null ; /*
         * The folder size (number of items) doesn't respect filters. That
         * could be confusing for users, but that's safer than displaying
         * zero items for a folder that contains files not visible with a
         * currently applied filter. -ab
         */ $ size = $ itemType == MediaLibraryItem :: TYPE_FILE ? $ this -> getStorageDisk ( ) -> size ( $ path ) : $ this -> getFolderItemCount ( $ path ) ; $ publicUrl = $ this -> getPathUrl ( $ relativePath ) ; return new MediaLibraryItem ( $ relativePath , $ size , $ lastModified , $ itemType , $ publicUrl ) ; }
Initializes a library item from a path and item type.
@param string $path Specifies the item path relative to the storage disk root.
@param string $itemType Specifies the item type.
@return mixed Returns the MediaLibraryItem object or NULL if the item is not visible.
Initializes a library item from a path and item type .