smartcrop-rails 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -6
- data/lib/smartcrop/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72c6953a42f746f47b706e0419ec0a60e5995734
|
4
|
+
data.tar.gz: c4217daef9449c42cf7abb49c3412246ec87bb68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 399f734760c67fa53006b24f77ac8ec1573de9f6bfe68912953fd998cbe88293c10bd3e9a4dbb7b1571b90a810d31b6a07cd52c752cf99d5adc5b9422a4a4d08
|
7
|
+
data.tar.gz: fcb116c065571d193c07553d282aeac1fbd2739fe03da2310a2733cfaaa2a6190002d5ccdeee37c9ac67167d4e467ec5b02d27676e0a3f097e5aafba1fb5d51a
|
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# smartcrop-rails
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/smartcrop-rails.svg)](http://badge.fury.io/rb/smartcrop-rails)
|
2
3
|
|
3
|
-
|
4
|
+
smartcrop-rails gem is the integration of smartcrop.js javascript library for your Rails 4 application.
|
4
5
|
|
5
|
-
|
6
|
+
Smartcrop.js implements an algorithm to find good crops for images.
|
7
|
+
Demo: For content aware image cropping http://29a.ch/2014/04/03/smartcrop-content-aware-image-cropping
|
8
|
+
|
9
|
+
source: https://github.com/jwagner/smartcrop.js/
|
6
10
|
|
7
11
|
## Installation
|
8
12
|
|
@@ -20,19 +24,41 @@ Or install it yourself as:
|
|
20
24
|
|
21
25
|
$ gem install smartcrop-rails
|
22
26
|
|
27
|
+
Now you need to edit your `app/assets/javascripts/application.js` file and add the following line:
|
28
|
+
``` javascript
|
29
|
+
//= require smartcrop
|
30
|
+
```
|
31
|
+
|
23
32
|
## Usage
|
24
33
|
|
25
|
-
|
34
|
+
Here is the example working code to test with your Rails application.
|
35
|
+
|
36
|
+
Add this sample code to your `app/assets/javascripts/application.js` file
|
37
|
+
|
38
|
+
``` javascript
|
39
|
+
$(document).ready(function(){
|
40
|
+
|
41
|
+
SmartCrop.crop(image, {width: 100, height: 100}, function(result){console.log(result);});
|
42
|
+
|
43
|
+
});
|
44
|
+
```
|
45
|
+
|
46
|
+
*Note:* Here i am using `gem 'jquery-turbolinks'` for using the jquery $(document).ready function
|
47
|
+
|
48
|
+
|
49
|
+
## Full documentation
|
50
|
+
|
51
|
+
Read the smartcrop.js documentation here https://github.com/jwagner/smartcrop.js/
|
26
52
|
|
27
53
|
## Development
|
28
54
|
|
29
|
-
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.
|
55
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
56
|
|
31
57
|
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](https://rubygems.org).
|
32
58
|
|
33
59
|
## Contributing
|
34
60
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
61
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sadiqmmm/smartcrop-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
62
|
|
37
63
|
|
38
64
|
## License
|