'text' => $this->l10n->t('newer'),
'class' => 'previous' . ($this->getPage() == 1 ? ' disabled' : '')
],
- 'next' => [
+ 'next' => [
'url' => Strings::ensureQueryParameter($this->baseQueryString . '&page=' . ($this->getPage() + 1)),
'text' => $this->l10n->t('older'),
- 'class' => 'next' . ($displayedItemCount < $this->getItemsPerPage() ? ' disabled' : '')
+ 'class' => 'next' . ($displayedItemCount < $this->getItemsPerPage() ? ' disabled' : '')
]
];
$numpages = (int) ceil($totalItemCount / $this->getItemsPerPage());
$numstart = 1;
- $numstop = $numpages;
+ $numstop = $numpages;
// Limit the number of displayed page number buttons.
if ($numpages > 8) {
$numstart = ($this->getPage() > 4) ? ($this->getPage() - 4) : 1;
- $numstop = ($this->getPage() > ($numpages - 7)) ? $numpages : ($numstart + 8);
+ $numstop = ($this->getPage() > ($numpages - 7)) ? $numpages : ($numstart + 8);
}
$pages = [];
$data['pages'] = $pages;
- $lastpage = (($numpages > intval($numpages)) ? intval($numpages)+1 : $numpages);
+ $lastpage = (($numpages > intval($numpages)) ? intval($numpages) + 1 : $numpages);
$data['next'] = [
'url' => Strings::ensureQueryParameter($this->baseQueryString . '&page=' . ($this->getPage() + 1)),
public function __construct(string $data, string $type = '', string $filename = '', bool $imagick = true)
{
$this->filename = $filename;
- $type = Images::addMimeTypeByDataIfInvalid($type, $data);
- $type = Images::addMimeTypeByExtensionIfInvalid($type, $filename);
+ $type = Images::addMimeTypeByDataIfInvalid($type, $data);
+ $type = Images::addMimeTypeByExtensionIfInvalid($type, $filename);
if (Images::isSupportedMimeType($type)) {
$this->originType = $this->outputType = Images::getImageTypeByMimeType($type);
private function isAnimatedWebP(string $data)
{
$header_format = 'A4Riff/I1Filesize/A4Webp/A4Vp/A74Chunk';
- $header = @unpack($header_format, $data);
+ $header = @unpack($header_format, $data);
if (!isset($header['Riff']) || strtoupper($header['Riff']) !== 'RIFF') {
return false;
return false;
}
- $width = $this->getWidth();
+ $width = $this->getWidth();
$height = $this->getHeight();
$scale = Images::getScalingDimensions($width, $height, $max);
return;
}
- $w = imagesx($this->image);
- $h = imagesy($this->image);
+ $w = imagesx($this->image);
+ $h = imagesy($this->image);
$flipped = imagecreate($w, $h);
if ($horiz) {
for ($x = 0; $x < $w; $x++) {
return false;
}
- $width = $this->getWidth();
+ $width = $this->getWidth();
$height = $this->getHeight();
if ((!$width) || (!$height)) {
if ($width < $min && $height < $min) {
if ($width > $height) {
- $dest_width = $min;
+ $dest_width = $min;
$dest_height = intval(($height * $min) / $width);
} else {
- $dest_width = intval(($width * $min) / $height);
+ $dest_width = intval(($width * $min) / $height);
$dest_height = $min;
}
} else {
if ($width < $min) {
- $dest_width = $min;
+ $dest_width = $min;
$dest_height = intval(($height * $min) / $width);
} else {
if ($height < $min) {
- $dest_width = intval(($width * $min) / $height);
+ $dest_width = intval(($width * $min) / $height);
$dest_height = $min;
} else {
- $dest_width = $width;
+ $dest_width = $width;
$dest_height = $height;
}
}
imagedestroy($this->image);
}
- $this->image = $dest;
+ $this->image = $dest;
$this->width = imagesx($this->image);
$this->height = imagesy($this->image);
}
}
$row[] = [$colors['r'], $colors['g'], $colors['b']];
} else {
- $index = imagecolorat($image->image, $x, $y);
+ $index = imagecolorat($image->image, $x, $y);
$colors = @imagecolorsforindex($image->image, $index);
- $row[] = [$colors['red'], $colors['green'], $colors['blue']];
+ $row[] = [$colors['red'], $colors['green'], $colors['blue']];
}
}
$pixels[] = $row;
if ($this->isImagick()) {
$this->image = new Imagick();
- $draw = new ImagickDraw();
+ $draw = new ImagickDraw();
$this->image->newImage($scaled['width'], $scaled['height'], '', 'png');
} else {
$this->image = imagecreatetruecolor($scaled['width'], $scaled['height']);
for ($y = 0; $y < $scaled['height']; ++$y) {
for ($x = 0; $x < $scaled['width']; ++$x) {
- [$r, $g, $b] = $pixels[$y][$x];
+ list($r, $g, $b) = $pixels[$y][$x];
if ($draw !== null) {
$draw->setFillColor("rgb($r, $g, $b)");
$draw->point($x, $y);