本文整理匯總了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);
}
}
}