GdMediaHandler.php: add comments

This commit is contained in:
Zankaria 2025-03-20 17:04:27 +01:00
parent c4fcb8e686
commit c498f38965

View file

@ -5,6 +5,9 @@ use Vichan\Data\ThumbGenerationResult;
use Vichan\Functions\Fs;
/**
* Basically a fallback implementation. GD does not handle color profiles outside of webp.
*/
class GdMediaHandler implements MediaHandler {
private const PHP81 = \PHP_MAJOR_VERSION >= 8 && \PHP_MINOR_VERSION >= 1;
@ -41,6 +44,7 @@ class GdMediaHandler implements MediaHandler {
public static function imageSaveTo(mixed $gd, string $file, string $mime) {
// Somebody should tune the quality and speed values...
// Won't be me.
switch ($mime) {
case 'image/jpeg':
return \imagejpeg($gd, $file, 50);
@ -132,6 +136,7 @@ class GdMediaHandler implements MediaHandler {
/**
* @param bool $strip_redraw If the EXIF metadata should be stripped by redrawing it.
* May cause the loss of color profiles. Orientation is still handled.
*/
public function __construct(bool $strip_redraw) {
$this->strip_redraw = $strip_redraw;