本文整理汇总了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();
}
示例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();
}
示例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);
}
}
}