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


PHP IOHelper::getMimeType方法代码示例

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


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

示例1: getMimeType

 /**
  * @return mixed
  */
 public function getMimeType()
 {
     if (!$this->_mimeType) {
         $this->_mimeType = IOHelper::getMimeType($this->getRealPath());
     }
     return $this->_mimeType;
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:10,代码来源:File.php

示例2: __construct

 /**
  * Constructor
  *
  * @param null $imagePath
  * @param null $imageUrl
  */
 public function __construct($imagePath = null, $imageUrl = null)
 {
     if ($imagePath != 'null') {
         $this['path'] = $imagePath;
         $imageInfo = @getimagesize($imagePath);
         $this['width'] = $imageInfo[0];
         $this['height'] = $imageInfo[1];
         $this['extension'] = IOHelper::getExtension($imagePath);
         $this['mimeType'] = IOHelper::getMimeType($imagePath);
         $this['size'] = IOHelper::getFileSize($imagePath);
     }
     if ($imageUrl != 'null') {
         $this['url'] = $imageUrl;
     }
 }
开发者ID:martinleveille,项目名称:Imager-Craft,代码行数:21,代码来源:Imager_ImageModel.php

示例3: getUrl

 /**
  * Get cropped image url.
  *
  * @param null|array $settings
  *
  * @return string
  */
 public function getUrl($settings = null)
 {
     // Get image
     $file = $this->getFile();
     // Do the cropping
     $this->applyCrop($file, $settings);
     // Get base64 of crop
     $base64 = $this->getBase64($file);
     // Get mime
     $mime = IOHelper::getMimeType($file);
     // Delete the temp image
     IOHelper::deleteFile($file);
     // Return base64 string
     return 'data:' . $mime . ';base64,' . $base64;
 }
开发者ID:boboldehampsink,项目名称:cropassets,代码行数:22,代码来源:CropAssetsModel.php

示例4: __construct

 /**
  * Constructor
  *
  * @param null $imagePath
  * @param null $imageUrl
  */
 public function __construct($imagePath = null, $imageUrl = null, $paths = null, $transform = null)
 {
     if ($imagePath != 'null') {
         $this['path'] = $imagePath;
         $this['extension'] = IOHelper::getExtension($imagePath);
         $this['mimeType'] = IOHelper::getMimeType($imagePath);
         $this['size'] = IOHelper::getFileSize($imagePath);
         $imageInfo = @getimagesize($imagePath);
         if (is_array($imageInfo) && $imageInfo[0] !== '' && $imageInfo[1] !== '') {
             $this['width'] = $imageInfo[0];
             $this['height'] = $imageInfo[1];
         } else {
             // Couldn't get size. Calculate size based on source image and transform.
             $sourceImageInfo = @getimagesize($paths->sourcePath . $paths->sourceFilename);
             $sourceSize = new \Imagine\Image\Box($sourceImageInfo[0], $sourceImageInfo[1]);
             $targetCrop = craft()->imager->getCropSize($sourceSize, $transform);
             $this['width'] = $targetCrop->getWidth();
             $this['height'] = $targetCrop->getHeight();
         }
     }
     if ($imageUrl != 'null') {
         $this['url'] = $imageUrl;
     }
 }
开发者ID:aelvan,项目名称:Imager-Craft,代码行数:30,代码来源:Imager_ImageModel.php

示例5: getMimeType

 /**
  * @return string
  */
 public function getMimeType()
 {
     return IOHelper::getMimeType($this->filename);
 }
开发者ID:amite,项目名称:arc-va,代码行数:7,代码来源:AssetFileModel.php

示例6: _validateImage

 /**
  * Validates that temp file is actually an image file
  *
  * @param string $remoteImagePath url of remote image
  * @param string $tempLocalImage file pointer to temp image
  *
  * @return boolean
  */
 private function _validateImage($remoteImagePath, $tempLocalImage)
 {
     // Check to make sure the asset is an image
     if (IOHelper::getFileKind(IOHelper::getExtension($tempLocalImage)) === 'image' && substr(IOHelper::getMimeType($tempLocalImage), 0, 5) === 'image') {
         return true;
     }
     return false;
 }
开发者ID:lukeholder,项目名称:craft-instablog,代码行数:16,代码来源:InstaBlog_ImportService.php

示例7: _uploadFile

 /**
  * Upload a file to Rackspace.
  *
  * @param $targetUri
  * @param $sourceFile
  *
  * @return bool
  */
 private function _uploadFile($targetUri, $sourceFile)
 {
     $fileSize = IOHelper::getFileSize($sourceFile);
     $fp = fopen($sourceFile, "r");
     $headers = array('Content-type: ' . IOHelper::getMimeType($sourceFile), 'Content-length: ' . $fileSize);
     $curlOptions = array(CURLOPT_UPLOAD => true, CURLOPT_INFILE => $fp, CURLOPT_INFILESIZE => $fileSize);
     $targetUri = $this->_prepareRequestURI($this->getSettings()->container, $targetUri);
     $this->_doAuthenticatedRequest(static::RACKSPACE_STORAGE_OPERATION, $targetUri, 'PUT', $headers, $curlOptions);
     fclose($fp);
     return true;
 }
开发者ID:ericnormannn,项目名称:m,代码行数:19,代码来源:RackspaceAssetSourceType.php


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