You've already forked imgproxy
mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-12-09 23:41:58 +02:00
Fix max_bytes option
This commit is contained in:
@@ -209,6 +209,10 @@ func saveImageToFitBytes(ctx context.Context, po *options.ProcessingOptions, img
|
||||
var diff float64
|
||||
quality := po.GetQuality()
|
||||
|
||||
if err := img.CopyMemory(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for {
|
||||
imgdata, err := img.Save(po.Format, quality)
|
||||
if err != nil || len(imgdata.Data) <= po.MaxBytes || quality <= 10 {
|
||||
|
||||
Reference in New Issue
Block a user