forked from leftypol/leftypol
MediaHandler: update
This commit is contained in:
parent
527f6372bb
commit
db3b6984f9
3 changed files with 15 additions and 17 deletions
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace Vichan\Service\Media;
|
||||
|
||||
use Vichan\Data\ThumbGenerationResult;
|
||||
use Vichan\Data\{MediaInstallResult, ThumbGenerationResult};
|
||||
use Vichan\Functions\Metadata;
|
||||
|
||||
|
||||
|
@ -58,13 +58,13 @@ class FallbackMediaHandler implements MediaHandler {
|
|||
string $thumb_preferred_out_mime,
|
||||
int $thumb_max_width,
|
||||
int $thumb_max_height
|
||||
) {
|
||||
): MediaInstallResult {
|
||||
list($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);
|
||||
|
||||
$this->move_or_link_or_copy($source_file_kind, $source_file_path, $out_path);
|
||||
|
||||
return $this->generateThumb(
|
||||
$thumb = $this->generateThumb(
|
||||
$handle,
|
||||
$thumb_preferred_out_file_dir,
|
||||
$thumb_preferred_out_file_name,
|
||||
|
@ -72,6 +72,7 @@ class FallbackMediaHandler implements MediaHandler {
|
|||
$thumb_max_width,
|
||||
$thumb_max_height
|
||||
);
|
||||
return new MediaInstallResult($thumb, $out_path);
|
||||
}
|
||||
|
||||
public function generateThumb(
|
||||
|
@ -85,7 +86,6 @@ class FallbackMediaHandler implements MediaHandler {
|
|||
return new ThumbGenerationResult(
|
||||
$this->path,
|
||||
$this->mime,
|
||||
false,
|
||||
\min($this->width, $max_width),
|
||||
\min($this->height, $max_height)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue