No commit activity in last 3 years
No release in over 3 years
Carrierwave Neo4j plugin that allows create image from data uri
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12.5
~> 11.2.2
~> 0.5.3
~> 0.8

Runtime

 Project Readme

Gem VersionCode Climate

Carrierwave::Neo4j::Data::Uri !! Kudos !!

Carrierwave Neo4j plugin that allows to create image from data uri

Installation

Add this line to your application's Gemfile:

gem 'carrierwave-neo4j-data-uri'

And then execute:

$ bundle

Or install it yourself as:

$ gem install carrierwave-neo4j-data-uri

Next to install it run

$ rails generate carrierwave_neo4j_data_uri:install

Usage

class Image
  include Neo4j::ActiveNode

  property :attachment, type: String
  mount_uploader :attachment, AttachmentUploader
end

Then we can create image from data

image = Image.new
image.attachment_data_uri = 'data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP////8AAP///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=='
image.save

Optionally, to customize the file name, specify the #{column}_data_filename and #{column}_data_mimetype attributes before the #{column}_data_uri attribute.

image = Image.find 'f854208e-3fc9-4bf7-b9c9-dad46c596ed6'
image.attachment_data_filename = 'somefile.jpg'
image.attachment_data_mimetype = 'image/jpeg'
image.attachment_data_uri = 'data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP////8AAP///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=='
image.save

Documentation

Documentation is available here

Example

Usage examples is also available here

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it ( https://github.com/vishalgarg231/carrierwave-neo4j-data-uri/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request