ThumbGenerator: broaden scop to media handler

This commit is contained in:
Zankaria 2025-03-18 11:26:30 +01:00
parent 5f85ca7f44
commit f3ce9bf055
3 changed files with 4 additions and 5 deletions

View file

@ -4,7 +4,7 @@ namespace Vichan\Service\Media;
use Vichan\Data\ThumbGenerationResult;
class FallbackThumbGenerator implements ThumbGenerator {
class FallbackMediaHandler implements MediaHandler {
private string $path;
private int $width;
private int $height;

View file

@ -5,7 +5,7 @@ use Vichan\Data\ThumbGenerationResult;
use Vichan\Functions\Fs;
class GdThumbGenerator implements ThumbGenerator {
class GdMediaHandler implements MediaHandler {
private const PHP81 = \PHP_MAJOR_VERSION >= 8 && \PHP_MINOR_VERSION >= 1;
private const MIME_TO_EXT = [

View file

@ -4,7 +4,7 @@ namespace Vichan\Service\Media;
use Vichan\Data\ThumbGenerationResult;
interface ThumbGenerator {
interface MediaHandler {
public function supportsMime(string $mime): bool;
/**
@ -19,8 +19,7 @@ interface ThumbGenerator {
* @return ThumbGenerationResult
*/
public function generateThumb(
string $source_file_path,
string $source_file_mime,
mixed $handle,
string $preferred_out_file_path,
string $preferred_out_mime,
int $max_width,