mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-03 10:43:58 +02:00
Use VIPS_META_ORIENTATION in the latest versions of vips
This commit is contained in:
parent
8e69236b6b
commit
447e53fc4e
11
vips.c
11
vips.c
@ -157,7 +157,7 @@ vips_svgload_go(void *buf, size_t len, double scale, VipsImage **out) {
|
||||
int
|
||||
vips_heifload_go(void *buf, size_t len, VipsImage **out) {
|
||||
#if VIPS_SUPPORT_HEIF
|
||||
return vips_heifload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, "autorotate", 1, NULL);
|
||||
return vips_heifload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL);
|
||||
#else
|
||||
vips_error("vips_heifload_go", "Loading HEIF is not supported");
|
||||
return 1;
|
||||
@ -165,13 +165,20 @@ vips_heifload_go(void *buf, size_t len, VipsImage **out) {
|
||||
}
|
||||
|
||||
int
|
||||
vips_get_exif_orientation(VipsImage *image) {
|
||||
vips_get_orientation(VipsImage *image) {
|
||||
#ifdef VIPS_META_ORIENTATION
|
||||
int orientation;
|
||||
|
||||
if (vips_image_get_int(image, VIPS_META_ORIENTATION, &orientation) == 0)
|
||||
return orientation;
|
||||
#else
|
||||
const char *orientation;
|
||||
|
||||
if (
|
||||
vips_image_get_typeof(image, EXIF_ORIENTATION) == VIPS_TYPE_REF_STRING &&
|
||||
vips_image_get_string(image, EXIF_ORIENTATION, &orientation) == 0
|
||||
) return atoi(orientation);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
2
vips.go
2
vips.go
@ -337,7 +337,7 @@ func (img *vipsImage) Resize(scale float64, hasAlpa bool) error {
|
||||
}
|
||||
|
||||
func (img *vipsImage) Orientation() C.int {
|
||||
return C.vips_get_exif_orientation(img.VipsImage)
|
||||
return C.vips_get_orientation(img.VipsImage)
|
||||
}
|
||||
|
||||
func (img *vipsImage) Rotate(angle int) error {
|
||||
|
2
vips.h
2
vips.h
@ -32,7 +32,7 @@ int vips_gifload_go(void *buf, size_t len, int pages, VipsImage **out);
|
||||
int vips_svgload_go(void *buf, size_t len, double scale, VipsImage **out);
|
||||
int vips_heifload_go(void *buf, size_t len, VipsImage **out);
|
||||
|
||||
int vips_get_exif_orientation(VipsImage *image);
|
||||
int vips_get_orientation(VipsImage *image);
|
||||
void vips_strip_meta(VipsImage *image);
|
||||
|
||||
int vips_support_smartcrop();
|
||||
|
Loading…
Reference in New Issue
Block a user