Using vips for creating derivatives

Hey there,

First, thanks a lot for this file upload toolkit!
Now to my question.
I am creating derivatives for my image uploads.
I was able to make ImageMagick work.
I wanted to switch to libvips to take advantage of its faster processing as compared to ImageMagick, but I am getting the following error:

NameError (undefined local variable or method `image’ for GenerateThumbnail:Class):

Here’s the code that’s failing (in lib/generate_thubmnail.rb):

require "image_processing/vips"

class GenerateThumbnail
  def self.call(file, width, height)
  result = Tempfile.new ["thumb-#{width}-#{height}", File.extname(file.path)]

  image = Vips::Image.thumbnail(file.path, width, height: height, size: :down)
  image.write_to_file(result.path)

  result
end

end

Code above is based on Better File Uploads with Shrine: Eager Processing.

Thank you!

Hi

Have you tried debugging the code by commenting out lines or using pry or byebug and stepping into the console to understand the issue?

Hiren