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


PHP AssetFileModel::getFolder方法代码示例

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


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

示例1: _getPathsForLocalAsset

 /**
  * Get paths for a local asset
  *
  * @param AssetFileModel $image
  */
 private function _getPathsForLocalAsset(AssetFileModel $image)
 {
     $assetSourcePath = craft()->config->parseEnvironmentString($image->getSource()->settings['url']);
     if (strrpos($assetSourcePath, 'http') !== false) {
         $parsedUrl = parse_url($assetSourcePath);
         $assetSourcePath = $parsedUrl['path'];
     }
     $this->sourcePath = ImagerService::fixSlashes(craft()->config->parseEnvironmentString($image->getSource()->settings['path']) . $image->getFolder()->path);
     $this->targetPath = ImagerService::fixSlashes(craft()->imager->getSetting('imagerSystemPath') . $assetSourcePath . $image->getFolder()->path) . $image->id . '/';
     $this->targetUrl = craft()->imager->getSetting('imagerUrl') . ImagerService::fixSlashes($assetSourcePath . $image->getFolder()->path, true) . $image->id . '/';
     $this->sourceFilename = $this->targetFilename = $image->filename;
 }
开发者ID:martinleveille,项目名称:Imager-Craft,代码行数:17,代码来源:Imager_ImagePathsModel.php

示例2: generateUrl

 /**
  * Generate a URL for a given Assets file in a Source Type.
  *
  * @param BaseAssetSourceType $sourceType
  * @param AssetFileModel      $file
  *
  * @return string
  */
 public static function generateUrl(BaseAssetSourceType $sourceType, AssetFileModel $file)
 {
     $baseUrl = $sourceType->getBaseUrl();
     $folderPath = $file->getFolder()->path;
     $fileName = $file->filename;
     $appendix = static::getUrlAppendix($sourceType, $file);
     return $baseUrl . $folderPath . $fileName . $appendix;
 }
开发者ID:jmstan,项目名称:craft-website,代码行数:16,代码来源:AssetsHelper.php

示例3: _getS3Path

 /**
  * Get a file's S3 path.
  *
  * @param AssetFileModel $file
  * @param                $settings The source settings to use.
  *
  * @return string
  */
 private function _getS3Path(AssetFileModel $file, $settings = null)
 {
     $folder = $file->getFolder();
     return $this->_getPathPrefix($settings) . $folder->path . $file->filename;
 }
开发者ID:webremote,项目名称:craft_boilerplate,代码行数:13,代码来源:S3AssetSourceType.php

示例4: finalizeTransfer

 /**
  * Finalize a file transfer between sources for the provided file.
  *
  * @param AssetFileModel $file The assetFileModel representing the file we're finalizing the transfer for.
  *
  * @return null
  */
 public function finalizeTransfer(AssetFileModel $file)
 {
     $this->deleteSourceFile($file->getFolder()->path . $file->filename);
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:11,代码来源:BaseAssetSourceType.php

示例5: _getFileSystemPath

 /**
  * Get a file's system path.
  *
  * @param AssetFileModel $file
  *
  * @return string
  */
 private function _getFileSystemPath(AssetFileModel $file)
 {
     $folder = $file->getFolder();
     $fileSourceType = craft()->assetSources->getSourceTypeById($file->sourceId);
     return $this->getSourceFileSystemPath($fileSourceType) . $folder->path . $file->filename;
 }
开发者ID:nathanedwards,项目名称:cowfields.craft,代码行数:13,代码来源:LocalAssetSourceType.php

示例6: transformExists

 /**
  * Return true if a transform exists at the location for a file.
  *
  * @param AssetFileModel $file
  * @param $location
  * @return mixed
  */
 public function transformExists(AssetFileModel $file, $location)
 {
     $this->_prepareForRequests();
     return (bool) @$this->_s3->getObjectInfo($this->getSettings()->bucket, $this->_getPathPrefix() . $file->getFolder()->fullPath . $location . '/' . $file->filename);
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:12,代码来源:S3AssetSourceType.php

示例7: getUrlforTransformByFile

 /**
  * Get URL for a transform by File Model and transform.
  *
  * @param AssetFileModel $file
  * @param $transform
  * @return string
  */
 public function getUrlforTransformByFile($file, $transform)
 {
     // Create URL to the image
     $sourceType = craft()->assetSources->getSourceTypeById($file->sourceId);
     $baseUrl = $sourceType->getBaseUrl();
     $folderPath = $baseUrl . $file->getFolder()->fullPath;
     $transformPath = $this->getTransformSubpath($transform);
     return $folderPath . $transformPath . $file->filename;
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:16,代码来源:AssetTransformsService.php

示例8: getUrlForFile

 /**
  * Get URL for a file.
  *
  * @param AssetFileModel $file
  * @param $transform
  * @return string
  */
 public function getUrlForFile(AssetFileModel $file, $transform = null)
 {
     $returnPlaceholder = false;
     if (!$transform || !in_array(IOHelper::getExtension($file->filename), ImageHelper::getAcceptedExtensions())) {
         $sourceType = craft()->assetSources->getSourceTypeById($file->sourceId);
         $base = $sourceType->getBaseUrl();
         return $base . $file->getFolder()->fullPath . $file->filename;
     }
     // Get the transform index model
     $existingTransformData = craft()->assetTransforms->getTransformIndex($file, $transform);
     // Does the file actually exist?
     if ($existingTransformData->fileExists) {
         return craft()->assetTransforms->getUrlforTransformByFile($file, $transform);
     } else {
         // File doesn't exist yet - load the TransformLoader and set the placeholder URL flag
         $placeholderUrl = UrlHelper::getResourceUrl('images/blank.gif');
         if (!$this->_includedTransformLoader) {
             $entityPlaceholderUrl = htmlspecialchars($placeholderUrl, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
             $spinnerUrl = UrlHelper::getResourceurl('images/spinner_transform.gif');
             $actionUrl = UrlHelper::getActionUrl('assets/generateTransform');
             craft()->templates->includeJsResource('js/TransformLoader.js');
             craft()->templates->includeJs('new TransformLoader(' . JsonHelper::encode($placeholderUrl) . ', ' . JsonHelper::encode($entityPlaceholderUrl) . ', ' . JsonHelper::encode($spinnerUrl) . ', ' . JsonHelper::encode($actionUrl) . ');');
             $this->_includedTransformLoader = true;
         }
         return $placeholderUrl . '#' . $existingTransformData->id;
     }
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:34,代码来源:AssetsService.php

示例9: _getRackspacePath

 /**
  * Get a file's S3 path.
  *
  * @param AssetFileModel $file
  *
  * @return string
  */
 private function _getRackspacePath(AssetFileModel $file)
 {
     $folder = $file->getFolder();
     return $this->_getPathPrefix() . $folder->path . $file->filename;
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:12,代码来源:RackspaceAssetSourceType.php

示例10: getAssetFilePath

 /**
  * @param AssetFileModel $asset
  *
  * @return string
  */
 protected function getAssetFilePath(AssetFileModel $asset)
 {
     return $asset->getSource()->getSourceType()->getBasePath() . $asset->getFolder()->path . $asset->filename;
 }
开发者ID:aladrach,项目名称:Bluefoot-Craft-Starter,代码行数:9,代码来源:SproutFormsService.php

示例11: transformExists

 /**
  * Return true if a transform exists at the location for a file.
  *
  * @param AssetFileModel $file
  * @param $location
  * @return mixed
  */
 public function transformExists(AssetFileModel $file, $location)
 {
     return (bool) $this->_getObjectInfo($this->_getPathPrefix() . $file->getFolder()->fullPath . $location . '/' . $file->filename);
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:11,代码来源:RackspaceAssetSourceType.php

示例12: copyTransform

 /**
  * Copy a transform for a file from source location to target location.
  *
  * @param AssetFileModel $file
  * @param $source
  * @param $target
  * @return mixed
  */
 public function copyTransform(AssetFileModel $file, $source, $target)
 {
     $fileFolder = $file->getFolder();
     $basePath = $this->_getSourceFileSystemPath() . $fileFolder->fullPath;
     IOHelper::copyFile($basePath . $source . '/' . $file->filename, $basePath . $target . '/' . $file->filename);
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:14,代码来源:LocalAssetSourceType.php


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