Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
carrierwave S3 post-processing
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nicolas de Moreau  
View profile  
 More options Feb 2, 1:51 am
From: Nicolas de Moreau <nico...@demoreau.be>
Date: Wed, 1 Feb 2012 22:51:59 -0800 (PST)
Local: Thurs, Feb 2 2012 1:51 am
Subject: carrierwave S3 post-processing
Hello,

I'm using carrierwave with carrierwave_direct to upload directly to
S3. Everything works fine without post-processing but when I try to do
the post-processing, I get a 403 forbidden error when trying to
execute the code:       self.remote_avatar_url =
avatar.direct_fog_url(:with_path => true)

My full code is:

config:

  CarrierWave.configure do |config|
    config.storage = :fog
    config.fog_directory = S3_CREDENTIALS[:bucket]
    config.fog_public     = false

    config.fog_credentials = {
      :provider => 'AWS',
      :aws_access_key_id => 'xxx',
      :aws_secret_access_key => 'xxx'
    }
  end

avatar_uploader.rb:

class AvatarUploader < CarrierWave::Uploader::Base
   include CarrierWave::RMagick
   include CarrierWaveDirect::Uploader
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}"
  end
   version :thumb do
     process :resize_to_limit => [50, 50]
   end
end

class ClipsController < ApplicationController
  def index
    if params[:key]
      clip = Clip.new
      clip.attachable_id = key[3]
      clip.attachable_type = "Pmdocument"
      clip.key = params[:key]
#      clip.save
      clip.save_and_process_avatar
    end

class Clip < ActiveRecord::Base
  def save_and_process_avatar(options = {})
    if options[:now] or 1==1
      self.remote_avatar_url = avatar.direct_fog_url(:with_path =>
true)
      save
    else
      Resque.enqueue(AvatarProcessor, attributes)
    end
  en
end

I've been hanging with this for about one day now. So I really need
help... Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »