I'm trying to make a crop with minimagick in Rails and something strange is happening.
The code is as follows:
def resize_crop
manipulate! do |img|
img.resize model.width
end
# resize_to_fill model.width, 0
end
The first time I call the function that resizes the image, it returns the following error:
ActiveRecord :: RecordInvalid: Validation failed: Crop Failed to manipulate with MiniMagick, maybe it is not an image? Original Error:
identify /tmp/mini_magick20170111-8437-12evsch.jpeg
failed with error: identify.im6: Not a JPEG file: starts with 0x23 0
Instead, the next time it runs correctly. I have tried to disable the validation of minimagick, but I see that the problem comes from mogrify.
Any suggestions to solve this behavior?