fix: incorrect resize logic when generating preview and thumbnails

This commit is contained in:
Damillora 2025-02-24 17:17:25 +00:00
parent fa74ef85b6
commit af30246132

View File

@ -119,12 +119,14 @@ func uploadBlob(c *gin.Context) {
previewFactor := float32(previewWidth) / float32(width) previewFactor := float32(previewWidth) / float32(width)
previewHeight := int(float32(height) * previewFactor) previewHeight := int(float32(height) * previewFactor)
if width <= previewWidth { if width <= previewWidth {
previewWidth = width
previewHeight = height previewHeight = height
} }
thumbnailWidth := 300 thumbnailWidth := 300
thumbnailFactor := float32(thumbnailWidth) / float32(width) thumbnailFactor := float32(thumbnailWidth) / float32(width)
thumbnailHeight := int(float32(height) * thumbnailFactor) thumbnailHeight := int(float32(height) * thumbnailFactor)
if width <= thumbnailWidth { if width <= thumbnailWidth {
thumbnailWidth = width
thumbnailHeight = height thumbnailHeight = height
} }