Hot questions for Using Spree in paperclip

Question:

I'm trying to upload Spree images to S3. but I'm having trouble to do it.

I get this error:

   raise e
        end
        if Gem::Version.new(Aws::VERSION) >= Gem::Version.new(2) &&
           Gem::Version.new(Aws::VERSION) <= Gem::Version.new("2.0.33")
          raise LoadError, "paperclip does not support aws-sdk versions 2.0.0 - 2.0.33.  Please upgrade aws-sdk to a newer version."
        end

For my understood the aws version needs to be upper to 2.0.33, but as you can see, this is my gemfile

#aws
gem 'aws-sdk', '~> 3'

Also I don't have gem for paperclip. Need to add one?


Answer:

Ok, "fixed it". It's a problem with paperclip and the latest version of aws.

There's two work around:

first:

gem 'aws-sdk', '< 3.0'

secod:

# config/initializers/aws.rb
Aws::VERSION =  Gem.loaded_specs["aws-sdk"].version

Question:

I have Two Application.

  1. Spree Application
  2. Rails Application

I have configure 1 module.

That module have image upload functionality.

I have to upload image in another application which is Rails Application.

How can i configure two application each other ?

How can i upload image on another Rails application and get URL back to Spree Application and that URL store in Spree Application ?


Answer:

I Found Answer.

This Answer for Two Application Hosted in Same Server.

First Application Which is in Spree. It have Image Model with attachment Field.

Change Code in "path" and "url" to upload image on another rails application which is hosted in same server.

For Example :

has_attached_file :attachment,

      styles: { mini: '48x48>', small: '100x100>', product: '240x240>', large: '600x600>' },

      default_style: :product,

           url: "#{MEDIASERVER_URL}/spree/products/:id/:style/:basename.:extension",

           path: "#{MEDIASERVER_PATH}/public/spree/products/:id/:style/:basename.:extension",

          convert_options: { all: '-strip -auto-orient -colorspace sRGB' }

MEDIASERVER_URL is a url to getting image from remotely. for example http://localhost:4000

MEDIASERVER_PATH is a path to store image in which location. It is a another rails application . for example /home/ServerName/ProjectName enter code here

Question:

There are similar questions around, but many are very old and none have an answer for this specific scenario: Paperclip automatically installed by Spree.

With Spree version 3.0.0, the output of gem list shows:

cocaine (0.5.7)
paperclip (4.2.4)

What needs to be fixed:

Paperclip::Errors::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController#create

I'm hoping to find out that I need to downgrade the cocain version... No dice yet.


Answer:

Turned out to be a problem with the images I was working with. I found out by trying to identify them in the command line.

identify poor-quality-image.png

It threw the same error.