本文整理汇总了PHP中Cake\ORM\Table::processImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::processImage方法的具体用法?PHP Table::processImage怎么用?PHP Table::processImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\ORM\Table
的用法示例。
在下文中一共展示了Table::processImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createVersions
/**
* Creates the different versions of images that are configured
*
* @param \Cake\ORM\Table $table
* @param array $entity
* @param array $operations
* @throws \Burzum\FileStorage\Event\Exception
* @throws \Exception
* @return false|null
*/
protected function _createVersions(Table $table, $entity, array $operations)
{
$Storage = StorageManager::adapter($entity['adapter']);
$path = $this->_buildPath($entity, true);
$tmpFile = $this->_tmpFile($Storage, $path, TMP . 'image-processing');
foreach ($operations as $version => $imageOperations) {
$hash = StorageUtils::hashOperations($imageOperations);
$string = $this->_buildPath($entity, true, $hash);
if ($this->adapterClass === 'AmazonS3' || $this->adapterClass === 'AwsS3') {
$string = str_replace('\\', '/', $string);
}
if ($Storage->has($string)) {
return false;
}
try {
$image = $table->processImage($tmpFile, null, array('format' => $entity['extension']), $imageOperations);
$Storage->write($string, $image->get($entity['extension']), true);
} catch (\Exception $e) {
$this->log($e->getMessage());
unlink($tmpFile);
throw $e;
}
}
unlink($tmpFile);
}