paperclip

Exception when trying to upload file from Flex to Rails (using paperclip)

半世苍凉 提交于 2019-11-28 01:48:47
问题 I'm trying to upload a Dynamically generated file from Flex (PNG image) to Ruby on Rails Server back end using the following code (from Flex on Rails book): public function save():void { var bitmapData:BitmapData = new BitmapData(width, height); bitmapData.draw(this); var ba:ByteArray = (new PNGEncoder()).encode(bitmapData); var fileRef:FileReference = new FileReference(); //TODO: Remove HardCoding of URL here var request : URLRequest = new URLRequest("http://localhost:3000/doodles"); request

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

不羁岁月 提交于 2019-11-28 01:32:24
I am attempting to setup Spree for the first time. Everything was going well until I hit the image upload. I have installed Imageamgick using homebrew on Mac OSX Mountain Lion. Uploading any image gives me the following error. Paperclip::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController#create Command :: identify -format %wx%h :file [paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/fq/9g_6hmg513g6137rb6sbghw00000gn/T/stream20121005-26943-16883d4.png is not recognized by the 'identify' command.> Paperclip:

Imagemagick issue on Lion installed with Homebrew

与世无争的帅哥 提交于 2019-11-28 01:09:55
I am trying to use the Paperclip gem on a Rails project so followed the docs and first installed Imagemagick using the Homebrew recipe. I added to my model my attachment has_attached_file :screenshot This worked OK and the file uploads functioned as expected I then wanted to add thumbnails to this, so again followed the docs and added to the model has_attached_file :screenshot, :styles => { :medium => "300x300>", :thumb => "100x100>" } At this point the uploads no longer worked I check the development logs and noticed this: [32mCommand[0m :: identify -format %wx%h '/var/folders/ky

How to upload a Base 64 image to Rails paperclip

萝らか妹 提交于 2019-11-28 00:16:51
I've tried a million different tutorials on the internet for how to upload a Base64 image from my iOS application to my rails app. It seems that no matter how I format the request it just won't get accepted. Does anyone know definitively how to upload a Base64 image to paperclip? I tried sending the param as JSON { "thumbnail_image": "base64_data..." } I also tried appending the data url { "thumbnail_image": "data:image/jpeg;base64,alkwdjlaks..." } I tried sending a JSON object with and without data url { "thumbnail_image": { "filename": "thumbnail.jpg", "file_data": "base64_data...", "content

Ruby on Rails - Paperclip Error

放肆的年华 提交于 2019-11-27 22:53:42
For reference I have been following this tutorial: https://devcenter.heroku.com/articles/paperclip-s3 Except I am in localhost testing right now, so I installed the Figaro gem and placed my S3 info in application.yml. Using Rails v4, Cocaine v0.5.3, and Paperclip v4.1.0 (unsure if any other gem version numbers need to be mentioned). I have a model called SubmissionDetails, where in its new.html.erb I am trying to upload a jpg to a column called attachment. Here is the relevant model code: has_attached_file :attachment, styles: { thumb: '200x200>', large: '800x800>' } validates_attachment

How do I tell paperclip to not save the original file?

微笑、不失礼 提交于 2019-11-27 21:55:26
How do I tell Paperclip not to save the original file when it is uploaded? Or even better, to store a scaled version of the file as the original? I believe that you can simply define a style for :original to have paperclip replace the original with that size. :styles => { :original => '300x168>', :cropped_thumb => {:geometry => "115x70#", :jcrop => true}, ...} Cris G's solution may be nice at most simple cases but it has limitations. consider that: style :original Paperclip process first of all others, so after that updated :original image (much smaller now) will be the source for following

Paperclip image url

旧时模样 提交于 2019-11-27 21:02:06
Stupid question? <img alt="Phone_large" src="/system/photos/1/small/phone_large.jpg?1238845838" /> Why is "?1238845838" added to the image path? How can I get my path/url without it? It's commonly referred to as a "cache buster". Paperclip automatically appends the timestamp for the last time the file was updated. Say you were to remove the cache buster and use /system/photos/1/small/phone_large.jpg instead. The URL wouldn't change when you changed the image and your visitors would see the old image for as long as they had it cached. If you want to remove it just call .url(:default, timestamp:

How do you access the raw content of a file uploaded with Paperclip / Ruby on Rails?

偶尔善良 提交于 2019-11-27 20:06:20
I'm using Paperclip / S3 for file uploading. I upload text-like files (not .txt, but they are essentially a .txt). In a show controller, I want to be able to get the contents of the uploaded file, but don't see contents as one of its attributes. What can I do here? attachment_file_name: "test.md", attachment_content_type: "application/octet-stream", attachment_file_size: 58, attachment_updated_at: "2011-06-22 01:01:40" PS - Seems like all the Paperclip tutorials are about images, not text files. Here's how I access the raw contents of my attachment: class Document has_attached_file :revision

How can I set paperclip's storage mechanism based on the current Rails environment?

好久不见. 提交于 2019-11-27 19:44:27
问题 I have a rails application that has multiple models with paperclip attachments that are all uploaded to S3. This app also has a large test suite that is run quite often. The downside with this is that a ton of files are uploaded to our S3 account on every test run, making the test suite run slowly. It also slows down development a bit, and requires you to have an internet connection in order to work on the code. Is there a reasonable way to set the paperclip storage mechanism based on the

File upload with Sinatra

不羁岁月 提交于 2019-11-27 18:24:40
I am trying to be able to upload files with Sinatra. I have the code here , but I'm getting the error "method file_hash does not exist" (see /lib/mvc/helpers/helpers.rb). What is going on here? Is there some dependency I'm missing. I've had good luck with the example code found on this thread . Including it here in case the link ever disappears: post '/upload' do unless params[:file] && (tmpfile = params[:file][:tempfile]) && (name = params[:file][:filename]) @error = "No file selected" return haml(:upload) end STDERR.puts "Uploading file, original name #{name.inspect}" while blk = tmpfile