diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-02 09:30:25 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-02 09:30:25 +0100 |
| commit | e24698d986bf3e145fa753f13c50704249f964d3 (patch) | |
| tree | 64ac8894be43e25bf4b5c135edcefedfaf6e2d25 | |
| parent | e2ba94c530baf380bb09731ef354e2c85a95e753 (diff) | |
| download | liberty-e24698d986bf3e145fa753f13c50704249f964d3.tar.gz liberty-e24698d986bf3e145fa753f13c50704249f964d3.tar.bz2 liberty-e24698d986bf3e145fa753f13c50704249f964d3.zip | |
Tidy Imagick usage in processor and mime.pdf plugins
processor.imagick: ImagickPixel('none') explicit colour, add clear() to rotate
mime.pdf: fix dest_branch absolute path in regenerate case — strip STORAGE_PKG_PATH
and ensure trailing slash before passing to liberty_generate_thumbnails
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | plugins/mime.pdf.php | 2 | ||||
| -rwxr-xr-x | plugins/processor.imagick.php | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/plugins/mime.pdf.php b/plugins/mime.pdf.php index 5b428f9..d2cbe77 100644 --- a/plugins/mime.pdf.php +++ b/plugins/mime.pdf.php @@ -221,7 +221,7 @@ function mime_pdf_thumbnail( $pFileHash ) { if( is_file( $thumb_file ) && filesize( $thumb_file ) > 0 ) { $genHash = [ 'attachment_id' => $pFileHash['attachment_id'], - 'dest_branch' => $pFileHash['upload']['dest_branch'] ?? $dest_branch, + 'dest_branch' => $pFileHash['upload']['dest_branch'] ?? rtrim( str_replace( STORAGE_PKG_PATH, '', $dest_branch ), '/' ).'/', 'source_file' => $thumb_file, 'type' => 'image/jpeg', ]; diff --git a/plugins/processor.imagick.php b/plugins/processor.imagick.php index e85c6ff..c02b640 100755 --- a/plugins/processor.imagick.php +++ b/plugins/processor.imagick.php @@ -120,7 +120,7 @@ function liberty_imagick_resize_image( &$pFileHash ) { } // destroy object - $im->destroy(); + $im->clear(); $ret = $destFile; } catch( ImagickException $e ) { @@ -145,9 +145,10 @@ function liberty_imagick_rotate_image( &$pFileHash ) { } elseif( empty( $pFileHash['degrees'] ) || !is_numeric( $pFileHash['degrees'] )) { $pFileHash['error'] = KernelTools::tra( 'Invalid rotation amount' ); } else { - $im->rotateImage( new ImagickPixel(), $pFileHash['degrees'] ); + $im->rotateImage( new ImagickPixel('none'), $pFileHash['degrees'] ); $im->writeImage( $pFileHash['source_file'] ); } + $im->clear(); } catch( ImagickException $e ) { \Bitweaver\bit_error_log( $e->getMessage().' '.$pFileHash['source_file'] ); $pFileHash['error'] = $e->getMessage(); |
