本文整理匯總了PHP中Library\Utility\Helper::thumbnail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Helper::thumbnail方法的具體用法?PHP Helper::thumbnail怎麽用?PHP Helper::thumbnail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::thumbnail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: previewAction
public function previewAction()
{
/**
* @var ExpenseTicket $expenseService
*/
$expenseService = $this->getServiceLocator()->get('service_finance_expense_expense_ticket');
$attachmenType = $this->params()->fromQuery('type', ExpenseTicket::ATTACHMENT_PREVIEW_TYPE_TICKET);
$id = $this->params()->fromQuery('id', null);
$width = $this->params()->fromQuery('width', 100);
$height = $this->params()->fromQuery('height', 100);
switch ($attachmenType) {
case ExpenseTicket::ATTACHMENT_PREVIEW_TYPE_TICKET:
$path = $expenseService->getAttachmentPathById($id);
break;
case ExpenseTicket::ATTACHMENT_PREVIEW_TYPE_ITEM:
$path = $expenseService->getItemAttachmentPathById($id);
break;
}
list($imageWidth, $imageHeight) = getimagesize($path);
if ($imageWidth && $imageHeight) {
if ($imageWidth > $imageHeight) {
$width = $height * $imageWidth / $imageHeight;
} else {
$height = $width * $imageHeight / $imageWidth;
}
}
header('Pragma: public');
header('Cache-Control: max-age = 604800');
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT');
Helper::thumbnail($path, $width, $height);
}