当前位置: 首页>>代码示例>>PHP>>正文


PHP FSFile::getSha1Base36方法代码示例

本文整理汇总了PHP中FSFile::getSha1Base36方法的典型用法代码示例。如果您正苦于以下问题:PHP FSFile::getSha1Base36方法的具体用法?PHP FSFile::getSha1Base36怎么用?PHP FSFile::getSha1Base36使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FSFile的用法示例。


在下文中一共展示了FSFile::getSha1Base36方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPropsFromPath

 /**
  * Get an associative array containing information about
  * a file with the given storage path.
  *
  * Resulting array fields include:
  *   - fileExists
  *   - size (filesize in bytes)
  *   - mime (as major/minor)
  *   - media_type (value to be used with the MEDIATYPE_xxx constants)
  *   - metadata (handler specific)
  *   - sha1 (in base 36)
  *   - width
  *   - height
  *   - bits (bitrate)
  *   - file-mime
  *   - major_mime
  *   - minor_mime
  *
  * @param string $path Filesystem path to a file
  * @param string|bool $ext The file extension, or true to extract it from the filename.
  *             Set it to false to ignore the extension.
  * @return array
  * @since 1.28
  */
 public function getPropsFromPath($path, $ext)
 {
     $fsFile = new FSFile($path);
     $info = $this->newPlaceholderProps();
     $info['fileExists'] = $fsFile->exists();
     if ($info['fileExists']) {
         $info['size'] = $fsFile->getSize();
         // bytes
         $info['sha1'] = $fsFile->getSha1Base36();
         # MIME type according to file contents
         $info['file-mime'] = $this->magic->guessMimeType($path, false);
         # Logical MIME type
         $ext = $ext === true ? FileBackend::extensionFromPath($path) : $ext;
         $info['mime'] = $this->magic->improveTypeFromExtension($info['file-mime'], $ext);
         list($info['major_mime'], $info['minor_mime']) = File::splitMime($info['mime']);
         $info['media_type'] = $this->magic->getMediaType($path, $info['mime']);
         # Height, width and metadata
         $handler = MediaHandler::getHandler($info['mime']);
         if ($handler) {
             $info['metadata'] = $handler->getMetadata($fsFile, $path);
             /** @noinspection PhpMethodParametersCountMismatchInspection */
             $gis = $handler->getImageSize($fsFile, $path, $info['metadata']);
             if (is_array($gis)) {
                 $info = $this->extractImageSizeInfo($gis) + $info;
             }
         }
     }
     return $info;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:53,代码来源:MWFileProps.php

示例2: wfDeprecated

 /**
  * Get a SHA-1 hash of a file in the local filesystem, in base-36 lower case
  * encoding, zero padded to 31 digits.
  *
  * 160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36
  * fairly neatly.
  *
  * @param $path string
  *
  * @return bool|string False on failure
  * @deprecated since 1.19
  */
 static function sha1Base36($path)
 {
     wfDeprecated(__METHOD__, '1.19');
     $fsFile = new FSFile($path);
     return $fsFile->getSha1Base36();
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:18,代码来源:File.php


注:本文中的FSFile::getSha1Base36方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。