forked from leftypol/leftypol
GdMediaHandler.php: update
This commit is contained in:
parent
2f23213ac5
commit
c3f7ed1475
1 changed files with 9 additions and 15 deletions
|
@ -91,8 +91,7 @@ class GdMediaHandler implements MediaHandler {
|
|||
string $source_file_path,
|
||||
string $source_file_mime,
|
||||
string $source_file_kind,
|
||||
string $preferred_out_file_dir,
|
||||
string $preferred_out_file_name,
|
||||
string $preferred_out_file_basepath,
|
||||
string $preferred_out_mime,
|
||||
int $max_width,
|
||||
int $max_height
|
||||
|
@ -101,7 +100,7 @@ class GdMediaHandler implements MediaHandler {
|
|||
$height = \imagesy($gd);
|
||||
|
||||
if ($width <= $max_width && $height <= $max_height) {
|
||||
$out_path = $preferred_out_file_dir . DIRECTORY_SEPARATOR . $preferred_out_file_name . '.' . Metadata\mime_to_ext($source_file_mime);
|
||||
$out_path = $preferred_out_file_basepath . '.' . Metadata\mime_to_ext($source_file_mime);
|
||||
|
||||
$this->move_or_link_or_copy($source_file_kind, $source_file_path, $out_path);
|
||||
|
||||
|
@ -112,7 +111,7 @@ class GdMediaHandler implements MediaHandler {
|
|||
$height
|
||||
);
|
||||
} else {
|
||||
$out_path = $preferred_out_file_dir . DIRECTORY_SEPARATOR . $preferred_out_file_name . '.' . Metadata\mime_to_ext($preferred_out_mime);
|
||||
$out_path = $preferred_out_file_basepath . '.' . Metadata\mime_to_ext($preferred_out_mime);
|
||||
|
||||
$gd_other = self::createCanvas($preferred_out_mime, $max_width, $max_height);
|
||||
\imagecopyresampled($gd_other, $gd, 0, 0, 0, 0, $max_width, $max_height, $width, $height);
|
||||
|
@ -205,16 +204,14 @@ class GdMediaHandler implements MediaHandler {
|
|||
|
||||
public function installMediaAndGenerateThumb(
|
||||
mixed $handle,
|
||||
string $media_preferred_out_file_dir,
|
||||
string $media_preferred_out_file_name,
|
||||
string $thumb_preferred_out_file_dir,
|
||||
string $thumb_preferred_out_file_name,
|
||||
string $media_preferred_out_file_basepath,
|
||||
string $thumb_preferred_out_file_basepath,
|
||||
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);
|
||||
$out_path = $media_preferred_out_file_basepath . '.' . Metadata\mime_to_ext($source_file_mime);
|
||||
|
||||
if ($this->strip_redraw) {
|
||||
if (!self::imageSaveTo($gd, $out_path, $source_file_mime)) {
|
||||
|
@ -229,8 +226,7 @@ class GdMediaHandler implements MediaHandler {
|
|||
$source_file_path,
|
||||
$source_file_mime,
|
||||
$source_file_kind,
|
||||
$thumb_preferred_out_file_dir,
|
||||
$thumb_preferred_out_file_name,
|
||||
$thumb_preferred_out_file_basepath,
|
||||
$thumb_preferred_out_mime,
|
||||
$thumb_max_width,
|
||||
$thumb_max_height
|
||||
|
@ -240,8 +236,7 @@ class GdMediaHandler implements MediaHandler {
|
|||
|
||||
public function generateThumb(
|
||||
mixed $handle,
|
||||
string $preferred_out_file_dir,
|
||||
string $preferred_out_file_name,
|
||||
string $preferred_out_file_basepath,
|
||||
string $preferred_out_mime,
|
||||
int $max_width,
|
||||
int $max_height
|
||||
|
@ -253,8 +248,7 @@ class GdMediaHandler implements MediaHandler {
|
|||
$source_file_path,
|
||||
$source_file_mime,
|
||||
$source_file_kind,
|
||||
$preferred_out_file_dir,
|
||||
$preferred_out_file_name,
|
||||
$preferred_out_file_basepath,
|
||||
$preferred_out_mime,
|
||||
$max_width,
|
||||
$max_height
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue