Fix resizing & add logs

parallel-fetching
gravel 3 years ago
parent d2f0cc4b35
commit 49f1c0ae7b
Signed by: gravel
GPG Key ID: C0538F3C906B308F

4
.gitignore vendored

@ -4,12 +4,14 @@ output/*.html
# Downloaded QR codes # Downloaded QR codes
output/qr-codes output/qr-codes
# Served icons
output/icons
# Server-side cache # Server-side cache
cache cache
# Local tests # Local tests
.test .test
.
# Kate # Kate
*.kate-swp *.kate-swp

@ -16,8 +16,8 @@
* @param string $size Image dimensions. * @param string $size Image dimensions.
*/ */
function room_icon_path_resized(string $room_id, string $size): string { function room_icon_path_resized(string $room_id, string $size): string {
global $ROOM_ICONS_CACHE; global $ROOM_ICONS;
return "$ROOM_ICONS_CACHE/$room_id-$size"; return "$ROOM_ICONS/$room_id-$size";
} }
/** /**
@ -75,7 +75,9 @@
// Resize image // Resize image
$gd_image = imagecreatefromstring($icon_cached_contents); $gd_image = imagecreatefromstring($icon_cached_contents);
$gd_resized = imagescale($gd_image, $width, $height); $gd_resized = imagescale($gd_image, $width, $height);
imagewebp($gd_resized, $icon_resized); if (!imagewebp($gd_resized, $icon_resized)) {
log_info("Converting image for $room_id to $size failed");
}
return room_icon_path_relative($room_id, $size); return room_icon_path_relative($room_id, $size);
} }

Loading…
Cancel
Save