MediaHandler: update

This commit is contained in:
Zankaria 2025-03-26 00:36:04 +01:00
parent 527f6372bb
commit db3b6984f9
3 changed files with 15 additions and 17 deletions

View file

@ -1,7 +1,7 @@
<?php
namespace Vichan\Service\Media;
use Vichan\Data\{Exif, ThumbGenerationResult};
use Vichan\Data\{Exif, MediaInstallResult, ThumbGenerationResult};
use Vichan\Functions\{Fs, Metadata};
@ -108,7 +108,6 @@ class GdMediaHandler implements MediaHandler {
return new ThumbGenerationResult(
$out_path,
$source_file_mime,
false,
$width,
$height
);
@ -128,7 +127,6 @@ class GdMediaHandler implements MediaHandler {
return new ThumbGenerationResult(
$out_path,
$preferred_out_mime,
false,
$max_width,
$max_height
);
@ -214,7 +212,7 @@ class GdMediaHandler implements MediaHandler {
string $thumb_preferred_out_mime,
int $thumb_max_width,
int $thumb_max_height
) {
): MediaInstallResult {
list($gd, $source_file_path, $source_file_mime, $source_file_kind) = $handle;
$out_path = $media_preferred_out_file_dir . DIRECTORY_SEPARATOR . $media_preferred_out_file_name . '.' . Metadata\mime_to_ext($source_file_mime);
@ -226,7 +224,7 @@ class GdMediaHandler implements MediaHandler {
$this->move_or_link_or_copy($source_file_kind, $source_file_path, $out_path);
}
return $this->generateThumbImpl(
$thumb = $this->generateThumbImpl(
$gd,
$source_file_path,
$source_file_mime,
@ -237,6 +235,7 @@ class GdMediaHandler implements MediaHandler {
$thumb_max_width,
$thumb_max_height
);
return new MediaInstallResult($thumb, $out_path);
}
public function generateThumb(