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