Not able to save Base64 Image using carrierwave gem in rails4 - ruby-on-rails

I want to save a image in base64 format sent by mobile device in my database. I have tried to install carrierwave-base64 Gem but no use. Can any one suggest me the right way to do it? I have tried all possible ways. I want clear code to upload a base64 image using carrierwave Gem.

Related

generating password protected pdfs using rails

Recently I was looking for some gem which can password protect our existing pdf files.
Basically we are fetching some invoice PDFS from aws . After fetching it from aws , we have to add password to the pdf and send it as an attachment in an email.
I tried with prawn/hexapdf/combined_pdf , but no success. Because with prawn i can not find a way to read an existing pdf. but prawn can easily password encrypt any pdf generated via prawn.
Any suggestion would be greatly appriciated.
Not really a gem, but is it possible to install and use a command line program like pdftk? I've been using it for years for similar problems with great success.

Cloudinary with rails won't show my picture

I am developing a Rails application and I want to upload a picture directly from my browser using Cloudinary.
I followed all steps from the Cloudinary page and ended up with a box and a question mark after I "uploaded" it, no picture at all. Any ideas what might be the problem?
I am not sure what you have used. But you should use carrierwave with cloudinary. Cloudinary having some complex way to handle display and save image if you don't use carrierwave.
But carreirwave provide simpler way to achieve uploading and display image.
Without using carrierwave
Using carrierwave in compbination
You should try the sample project and then check the differences:
https://github.com/cloudinary/cloudinary_gem/tree/master/samples/photo_album

Uploading image from PhoneGap to Carrierwave / Rails 3?

I'm trying to figure out the best way to upload a camera image from a PhoneGap app to a Rails 3 app that has Carrierwave on it. My thoughts so far:
Option 1) Use phonegap filetransfer functionality to upload to a temp folder on S3 then assign the URL to the remote_avatar_url for my carrierwave field. Then carrierwave does all the work for me in terms of grabbing the image, resizing, cropping, etc. Carrierwave will then send the files back over to S3 where they will be stored in the right places.
Option 2) Use phonegap filetransfer functionality to upload directly to my rails server then let carrierwave do the work from here. This seems more efficient, but I don't know how to assign an image that was posted to a rails api controller to Carrierwave so that it can do its thing. Any ideas assuming this is the best way to handle?
Thanks!
You can send the image as Base64/encode and than parse it on the CarrierWave side. Take a look at http://ograycoding.wordpress.com/2012/07/03/api-upload-with-carrierwave/

Uploading Images without using ImageMagick

I don't want to have to configure imagemagick but want to use a gem to be able to upload a picture from a form and put it into a database. Are there other options out there? I tried dragonfly and carrierwave but they require ImageMagick.
I often use Blitline which allows we to me to make any edits to the image (if needed) and then I have Blitline store it in an Amazon S3 bucket and place the image url in my database to save space in the database.

Trouble uploading image via paperclip and aws-sdk

I am using paperclip to upload photos to an AWS-S3 bucket. The photos are being accessed through a separate feed using Mechanize. I recently updated my gem file, and now paperclip apparently requires the aws-sdk gem instead of the aws-s3 gem. Now I am debugging code to accommodate the aws-sdk gem and I am stuck at uploading a file. My working code below using the aws-s3 gem:
image = agent.get(url).body
filename = "#{listing_id}:#{i}.jpg"
AWS::S3::S3Object.store(filename, image, S3_BUCKET_NAME)
"https://s3.amazonaws.com/#{S3_BUCKET_NAME}/#{filename}"
I get this error: undefined methodstore' for AWS::S3::S3Object:Class`
and from what I can gather, the new code is going to look something like this:
key = File.basename(filename)
s3.buckets[S3_BUCKET_NAME].objects[key].write(:file => filename)
Using aws-s3, the image was referenced in the store method. How do I reference the image using aws-sdk?
for now I am going back to an old paperclip version and reinstalling aws-s3, but I would like to keep my code up to date if possible. Any thoughts would be much appreciated.

Resources