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