mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-07 11:36:25 +02:00
Fixed autorotation when image is not resized
This commit is contained in:
parent
0ee53db54c
commit
8556be3426
@ -1,3 +1,7 @@
|
|||||||
|
## v1.1.5.1
|
||||||
|
|
||||||
|
- Fixed autorotation when image is not resazed
|
||||||
|
|
||||||
## v1.1.5
|
## v1.1.5
|
||||||
|
|
||||||
- Add CORS headers
|
- Add CORS headers
|
||||||
|
72
process.go
72
process.go
@ -295,56 +295,56 @@ func processImage(data []byte, imgtype imageType, po processingOptions, t *timer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err = vipsImportColourProfile(&img); err != nil {
|
if err = vipsImportColourProfile(&img); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = vipsFixColourspace(&img); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Check()
|
||||||
|
|
||||||
|
if angle != C.VIPS_ANGLE_D0 || flip {
|
||||||
|
if err = vipsImageCopyMemory(&img); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = vipsFixColourspace(&img); err != nil {
|
if angle != C.VIPS_ANGLE_D0 {
|
||||||
return nil, err
|
if err = vipsRotate(&img, angle); err != nil {
|
||||||
}
|
|
||||||
|
|
||||||
t.Check()
|
|
||||||
|
|
||||||
if angle != C.VIPS_ANGLE_D0 || flip {
|
|
||||||
if err = vipsImageCopyMemory(&img); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if angle != C.VIPS_ANGLE_D0 {
|
|
||||||
if err = vipsRotate(&img, angle); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if flip {
|
|
||||||
if err = vipsFlip(&img); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Check()
|
if flip {
|
||||||
|
if err = vipsFlip(&img); err != nil {
|
||||||
if po.Resize == FILL || po.Resize == CROP {
|
return nil, err
|
||||||
if po.Gravity == SMART {
|
|
||||||
if err = vipsImageCopyMemory(&img); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err = vipsSmartCrop(&img, po.Width, po.Height); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
left, top := calcCrop(int(img.Xsize), int(img.Ysize), po)
|
|
||||||
if err = vipsCrop(&img, left, top, po.Width, po.Height); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Check()
|
t.Check()
|
||||||
|
|
||||||
|
if (po.Width != imgWidth || po.Height != imgHeight) && (po.Resize == FILL || po.Resize == CROP) {
|
||||||
|
if po.Gravity == SMART {
|
||||||
|
if err = vipsImageCopyMemory(&img); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err = vipsSmartCrop(&img, po.Width, po.Height); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
left, top := calcCrop(int(img.Xsize), int(img.Ysize), po)
|
||||||
|
if err = vipsCrop(&img, left, top, po.Width, po.Height); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Check()
|
||||||
|
}
|
||||||
|
|
||||||
return vipsSaveImage(img, po.Format)
|
return vipsSaveImage(img, po.Format)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user