paperclip

Does Paperclip automatically clean up filenames?

前提是你 提交于 2020-01-12 13:55:54
问题 I'm using Thoughtbot's Paperclip gem to handle file uploads. I'm finding that when I upload a file with spaces in the filename, it gets stored with the spaces replaced with underscores. That's good. I also tried uploading a file with special characters like ~ and so on and they all got replaced with underscores. Great. Exactly what I want. But why is it happening? All I'm doing in my model is... has_attached_file( file_somefile, :path => ":rails_root/public/system/other/path/elements/

Rails Paperclip S3 rename thousands of files?

无人久伴 提交于 2020-01-12 05:54:29
问题 I'm trying to rename a lot of files in s3--changing the current paperclip has_attached_file :path from stuff/:id_:updated_at_:style.:extension to stuff/:id_:counter_:style.:extension , where :counter is a field in the same model as the image. I haven't the foggiest on how to rename all the files--preferably in a rake task. Incidentally, I'll be incrementing :counter each time a new file is saved to the record. This is Rails 3 and the latest Paperclip as of this posting. Any ideas? Thanks! 回答1

Zip up all Paperclip attachments stored on S3

依然范特西╮ 提交于 2020-01-12 04:31:27
问题 Paperclip is a great upload plugin for Rails. Storing uploads on the local filesystem or Amazon S3 seems to work well. I'd just assume store files on the localhost, but the use of S3 is required for this app as it will be hosted on Heroku. How would I go about getting all of my uploads/attachments from S3 in a single zipped download? Getting a zip of files from the local filesystem seems straight forward. It's getting the files from S3 that has me puzzled. I think it may have something to do

Zip up all Paperclip attachments stored on S3

跟風遠走 提交于 2020-01-12 04:31:09
问题 Paperclip is a great upload plugin for Rails. Storing uploads on the local filesystem or Amazon S3 seems to work well. I'd just assume store files on the localhost, but the use of S3 is required for this app as it will be hosted on Heroku. How would I go about getting all of my uploads/attachments from S3 in a single zipped download? Getting a zip of files from the local filesystem seems straight forward. It's getting the files from S3 that has me puzzled. I think it may have something to do

Paperclip is missing the Protocol (https) with Amazon S3

…衆ロ難τιáo~ 提交于 2020-01-11 07:45:10
问题 In production.rb: config.paperclip_defaults = { s3_host_name: "s3.#{ENV.fetch('AWS_REGION')}.amazonaws.com", storage: :s3, s3_credentials: { bucket: ENV.fetch('S3_BUCKET_NAME'), access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'), secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'), s3_region: ENV.fetch('AWS_REGION'), } } I don't have anything in the initializers/paperclip.rb. In my model: class MyModel < ApplicationRecord has_attached_file :photo, styles: { thumb: '100x100>', square: '200x200#',

Ruby on Rails, Paperclip: “identify” command working in cmd but not in app

血红的双手。 提交于 2020-01-10 20:00:07
问题 I've installed ImageMagick on my Windows 7 64bit and I have the Paperclip Gem. My User model looks like this: class User < ActiveRecord::Base # Paperclip has_attached_file :photo, :styles => { :thumb=> "100x100#", :small => "150x150>" } end In paperclip.rb and development.rb I have: Paperclip.options[:command_path] = 'C:/Program Files/ImageMagick-6.6.7-Q16' My _form looks like this: <%= form_for(@user, :html => { :multipart => true } ) do |f| %> <% if @user.errors.any? %> <div id="error

Rails 4 multiple file attachments with Paperclip

陌路散爱 提交于 2020-01-10 15:42:42
问题 I'm aware that there are several posts on Stackoverflow and several tutorials about this subject. None of them however manage to solve my issue and most of them are outdated as well. I am trying to add multiple images to a project using the paperclip gem in Rails 4. When i try uploading it i do see the asset attached in the params. They do not seem to be added to the project_paramns though.. Hope someone can help me out here. This is my projects_controller class ProjectsController <

Rails 4 multiple file attachments with Paperclip

对着背影说爱祢 提交于 2020-01-10 15:41:11
问题 I'm aware that there are several posts on Stackoverflow and several tutorials about this subject. None of them however manage to solve my issue and most of them are outdated as well. I am trying to add multiple images to a project using the paperclip gem in Rails 4. When i try uploading it i do see the asset attached in the params. They do not seem to be added to the project_paramns though.. Hope someone can help me out here. This is my projects_controller class ProjectsController <

Upload image post request over http to other application using Paperclip

我们两清 提交于 2020-01-06 17:58:41
问题 I am able to upload image attachements using paperclip to my application. But I would like to send the image to another application via faraday connection. Other attributes are successfully sent but not the attachment image. I am not sure what I should do to achieve this. 回答1: You need to use an HTTP library that can create Multipart Post requests. For example Typhoeus can do file uploads: https://github.com/typhoeus/typhoeus#handling-file-uploads. There's also Net::HTTP Multipart Post: https

RoR: not able to connect paperclip to Amazon S3

我是研究僧i 提交于 2020-01-06 06:25:44
问题 I have decided to deploy my app to Heroku and I was following their tutorials. However, Im trying to connect to my Amazon S3 bucket with a paperclip plugin right now and Im getting this error: ArgumentError in Images#index Showing app/views/images/index.html.erb where line #19 raised: syntax error on line 0, col 39: `bucket: (MY BUCKET HERE) access_key_id: (MY ACCESS KEY ID HERE) secret_access_key: (MY SECRET ACCESS KEY HERE) ' Extracted source (around line #19): 16: <%=h image.created_at %>