This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/media/events.php

60 lines
1.6 KiB
PHP
Raw Normal View History

2020-01-26 13:19:35 +00:00
<?php declare(strict_types=1);
2019-08-16 14:40:42 +00:00
class MediaResizeEvent extends Event
{
public $engine;
public $input_path;
public $input_type;
public $output_path;
public $target_format;
public $target_width;
public $target_height;
public $target_quality;
public $minimize;
public $ignore_aspect_ratio;
public $allow_upscale;
2019-11-02 19:57:34 +00:00
public function __construct(
String $engine,
string $input_path,
string $input_type,
string $output_path,
int $target_width,
int $target_height,
bool $ignore_aspect_ratio = false,
string $target_format = null,
int $target_quality = 80,
bool $minimize = false,
bool $allow_upscale = true
) {
2020-01-26 13:19:35 +00:00
parent::__construct();
2019-08-16 14:40:42 +00:00
assert(in_array($engine, MediaEngine::ALL));
$this->engine = $engine;
$this->input_path = $input_path;
$this->input_type = $input_type;
$this->output_path = $output_path;
$this->target_height = $target_height;
$this->target_width = $target_width;
$this->target_format = $target_format;
$this->target_quality = $target_quality;
$this->minimize = $minimize;
$this->ignore_aspect_ratio = $ignore_aspect_ratio;
$this->allow_upscale = $allow_upscale;
}
}
class MediaCheckPropertiesEvent extends Event
{
2020-01-29 20:22:50 +00:00
public $image;
2019-08-16 14:40:42 +00:00
public $file_name;
public $ext;
2020-01-29 20:22:50 +00:00
public function __construct(Image $image)
2019-08-16 14:40:42 +00:00
{
2020-01-26 13:19:35 +00:00
parent::__construct();
2020-01-29 20:22:50 +00:00
$this->image = $image;
$this->file_name = warehouse_path(Image::IMAGE_DIR, $image->hash);
$this->ext = strtolower($image->ext);
2019-08-16 14:40:42 +00:00
}
}