No commit activity in last 3 years
No release in over 3 years
This gem allows you to define `file`-attributes on an active record class which can receive base64-encoded strings which comes in handy for json rest clients posting images to a rails application. Simply post your base64-encoded string using the `_base64`-suffix on the attribute name.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.2.0
~> 4.1.0
 Project Readme

base64_attachment

Upload base64-encoded file attachments to a rails rest service

This gem allows you to define file-attributes on an active record class which can receive base64-encoded strings which comes in handy for json rest clients posting images to a rails application. Simply post your base64-encoded string using the _base64-suffix on the attribute name.

Usage

Register your model for the base64-hook

class Post < ActiveRecord::Base
  has_attached_base64 :image
end

Post json

{
  "post": {
    "image_base64": "base64-encoded string"
  }
}

The content-type as well as the original_filename is automatically generated based on magic numbers using the mime-magic-gem.