image resizer: fix incompatibility with libvips-8.8.
In libvips-8.8 the `auto_rotate` option was replaced with `no_rotate`. Using `auto_rotate` in libvips-8.8 fails, so we need a version check here.
This commit is contained in:
@@ -5,8 +5,13 @@ module DanbooruImageResizer
|
|||||||
SRGB_PROFILE = "#{Rails.root}/config/sRGB.icm"
|
SRGB_PROFILE = "#{Rails.root}/config/sRGB.icm"
|
||||||
|
|
||||||
# http://jcupitt.github.io/libvips/API/current/libvips-resample.html#vips-thumbnail
|
# http://jcupitt.github.io/libvips/API/current/libvips-resample.html#vips-thumbnail
|
||||||
THUMBNAIL_OPTIONS = { size: :down, linear: false, auto_rotate: false, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE }
|
if Vips.at_least_libvips?(8, 8)
|
||||||
CROP_OPTIONS = { linear: false, auto_rotate: false, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE, crop: :attention }
|
THUMBNAIL_OPTIONS = { size: :down, linear: false, no_rotate: true, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE }
|
||||||
|
CROP_OPTIONS = { linear: false, no_rotate: true, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE, crop: :attention }
|
||||||
|
else
|
||||||
|
THUMBNAIL_OPTIONS = { size: :down, linear: false, auto_rotate: false, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE }
|
||||||
|
CROP_OPTIONS = { linear: false, auto_rotate: false, export_profile: SRGB_PROFILE, import_profile: SRGB_PROFILE, crop: :attention }
|
||||||
|
end
|
||||||
|
|
||||||
# http://jcupitt.github.io/libvips/API/current/VipsForeignSave.html#vips-jpegsave
|
# http://jcupitt.github.io/libvips/API/current/VipsForeignSave.html#vips-jpegsave
|
||||||
JPEG_OPTIONS = { background: 255, strip: true, interlace: true, optimize_coding: true }
|
JPEG_OPTIONS = { background: 255, strip: true, interlace: true, optimize_coding: true }
|
||||||
|
|||||||
Reference in New Issue
Block a user