Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemStackError: stack level too deep #1345

Closed
mbajur opened this issue Mar 17, 2014 · 2 comments
Closed

SystemStackError: stack level too deep #1345

mbajur opened this issue Mar 17, 2014 · 2 comments

Comments

@mbajur
Copy link

mbajur commented Mar 17, 2014

I'm trying to generate few versions using my carrierwave uploader (rails 4.0.3, carrierwave 2.2.2) but all i can see is an exception SystemStackError: stack level too deep. My code looks like that:

keyframe_uploader.rb
class KeyframeUploader < CarrierWave::Uploader::Base

  # ...

  # Keyframe thumbnail sizes
  version :small do
    process resize_to_fill: [180, 180], if: :square?
    process resize_to_fill: [320, 180], if: :not_square?
  end

  version :medium do
    process resize_to_fill: [460, 460], if: :square?
    process resize_to_fill: [640, 460], if: :not_square?
  end

  version :large do
    process resize_to_fill: [720, 720], if: :square?
    process resize_to_fill: [1280, 720], if: :not_square?
  end


  private

    # Checks if image is a square
    def square? file
      img = Magick::Image.read(file.path)
      img[0].columns == img[0].rows
    end

    # Oposite to #square?
    def not_square? file
      !square? file
    end

end
keyframe.rb
class Keyframe < ActiveRecord::Base
  belongs_to :video

  mount_uploader :file, KeyframeUploader
end
Stack trace
SystemStackError: stack level too deep
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/workspace.rb:86

Have you any idea what can be wrong i here? Original question: http://stackoverflow.com/questions/22206350/stack-level-too-deep-when-using-carrierwave-versions-with-sidekiq

Thanks in advance!

@mshibuya
Copy link
Member

Dup of #1330.

@mbajur
Copy link
Author

mbajur commented Mar 17, 2014

Yes, that's it! Sorry, google didn't found that thread.
Thank you.

@mbajur mbajur closed this as completed Mar 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants