Mercurial > hg > mgallery
comparison mgtool.php @ 250:3af3b3f50cb0
Add settings for med_format and tn_format (currently allowed values are
"jpeg" and "webp") to specify the med/tn image formats. The default is JPEG.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 08 Dec 2018 15:51:02 +0200 |
parents | abcd21b01829 |
children | 19dab8b0c340 |
comparison
equal
deleted
inserted
replaced
249:abcd21b01829 | 250:3af3b3f50cb0 |
---|---|
107 // $img->normalizeImage(); | 107 // $img->normalizeImage(); |
108 $img->unsharpMaskImage(0, 0.5, 1, 0.05); | 108 $img->unsharpMaskImage(0, 0.5, 1, 0.05); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 | |
113 $img->setImageDepth(8); | 112 $img->setImageDepth(8); |
114 $img->setFormat($outFormat); | 113 switch (strtolower($outFormat)) |
115 $img->setImageCompression(Imagick::COMPRESSION_JPEG); | 114 { |
115 case "jpeg": | |
116 $img->setFormat("JPEG"); | |
117 $img->setImageCompression(Imagick::COMPRESSION_JPEG); | |
118 break; | |
119 | |
120 case "webp": | |
121 $img->setFormat("webp"); | |
122 $img->setOption('webp:method', '6'); | |
123 break; | |
124 | |
125 default: | |
126 return mgError("Unsupported MGallery med/tn format '".$tfmt."'.\n"); | |
127 } | |
128 | |
116 $img->setImageCompressionQuality($outQuality); | 129 $img->setImageCompressionQuality($outQuality); |
117 | 130 |
118 $img->stripImage(); | 131 $img->stripImage(); |
119 if (!empty($profiles)) | 132 if (!empty($profiles)) |
120 $img->profileImage("icc", $profiles["icc"]); | 133 $img->profileImage("icc", $profiles["icc"]); |
606 if ($updFlags & GUPD_MED_IMAGE) | 619 if ($updFlags & GUPD_MED_IMAGE) |
607 { | 620 { |
608 echo "1"; | 621 echo "1"; |
609 mgConvertImage($efilename, $medFilename, | 622 mgConvertImage($efilename, $medFilename, |
610 [mgGetSetting("med_width"), mgGetSetting("med_height")], | 623 [mgGetSetting("med_width"), mgGetSetting("med_height")], |
611 "JPEG", mgGetSetting("med_quality"), TRUE); | 624 mgGetSetting("med_format"), mgGetSetting("med_quality"), TRUE); |
612 } | 625 } |
613 | 626 |
614 if ($updFlags & GUPD_TN_IMAGE) | 627 if ($updFlags & GUPD_TN_IMAGE) |
615 { | 628 { |
616 echo "2"; | 629 echo "2"; |
617 mgConvertImage($efilename, $tnFilename, | 630 mgConvertImage($efilename, $tnFilename, |
618 [mgGetSetting("tn_width"), mgGetSetting("tn_height")], | 631 [mgGetSetting("tn_width"), mgGetSetting("tn_height")], |
619 "JPEG", mgGetSetting("tn_quality"), TRUE); | 632 mgGetSetting("tn_quality"), TRUE); |
620 } | 633 } |
621 } | 634 } |
622 | 635 |
623 // Check for .txt caption file | 636 // Check for .txt caption file |
624 if ($updFlags & GUPD_CAPTION) | 637 if ($updFlags & GUPD_CAPTION) |