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


PHP Asset::update方法代码示例

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


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

示例1: update

 /**
  * @return void
  */
 protected function update()
 {
     // only do this if the file exists and contains data
     if ($this->getDataChanged() || !$this->getCustomSetting("duration")) {
         try {
             $this->setCustomSetting("duration", $this->getDurationFromBackend());
         } catch (\Exception $e) {
             \Logger::err("Unable to get duration of video: " . $this->getId());
         }
     }
     $this->clearThumbnails();
     parent::update();
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:16,代码来源:Video.php

示例2: update

 protected function update()
 {
     $this->clearThumbnails();
     if ($this->getDataChanged()) {
         $tmpFile = $this->getTemporaryFile();
         try {
             $pageCount = $this->readPageCount($tmpFile);
             if ($pageCount !== null && $pageCount > 0) {
                 $this->setCustomSetting("document_page_count", $pageCount);
             }
         } catch (\Exception $e) {
         }
         unlink($tmpFile);
     }
     parent::update();
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:16,代码来源:Document.php

示例3: update

 /**
  * @return void
  */
 protected function update()
 {
     // only do this if the file exists and contains data
     if ($this->getDataChanged() || !$this->getCustomSetting("imageDimensionsCalculated")) {
         try {
             // save the current data into a tmp file to calculate the dimensions, otherwise updates wouldn't be updated
             // because the file is written in parent::update();
             $tmpFile = $this->getTemporaryFile();
             $dimensions = $this->getDimensions($tmpFile, true);
             unlink($tmpFile);
             if ($dimensions && $dimensions["width"]) {
                 $this->setCustomSetting("imageWidth", $dimensions["width"]);
                 $this->setCustomSetting("imageHeight", $dimensions["height"]);
             }
         } catch (\Exception $e) {
             Logger::error("Problem getting the dimensions of the image with ID " . $this->getId());
         }
         // this is to be downward compatible so that the controller can check if the dimensions are already calculated
         // and also to just do the calculation once, because the calculation can fail, an then the controller tries to
         // calculate the dimensions on every request an also will create a version, ...
         $this->setCustomSetting("imageDimensionsCalculated", true);
     }
     parent::update();
     $this->clearThumbnails();
     // now directly create "system" thumbnails (eg. for the tree, ...)
     if ($this->getDataChanged()) {
         try {
             $path = $this->getThumbnail(Image\Thumbnail\Config::getPreviewConfig())->getFileSystemPath();
             // set the modification time of the thumbnail to the same time from the asset
             // so that the thumbnail check doesn't fail in Asset\Image\Thumbnail\Processor::process();
             // we need the @ in front of touch because of some stream wrapper (eg. s3) which don't support touch()
             @touch($path, $this->getModificationDate());
         } catch (\Exception $e) {
             Logger::error("Problem while creating system-thumbnails for image " . $this->getRealFullPath());
             Logger::error($e);
         }
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:41,代码来源:Image.php


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