imagekitio 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 924d22974f5d592ea0f933077b74a4d37b133be8cd9b450d8b1182adeaa3e58d
4
- data.tar.gz: 1da1eab20f6424f07c018b6374eefe786dac87b7913e46b27b37b244316ddeed
3
+ metadata.gz: 394259c03d69887aa475f5df5882d880e17bbfa953372729c4275fdfdf7e737d
4
+ data.tar.gz: 71289a2646e242d26cb53e2c71c852a37df2652f8e26cb3b7d8b75b94cd0f06a
5
5
  SHA512:
6
- metadata.gz: b62b075781bec1c3eae66f5b8090091b42dccf8239a5a81472c78b0a50713bf5d8e573d19671df9de37f2cab5cf190db04b6b5eb7d87fbf1f167e4f72c328821
7
- data.tar.gz: a897fb5d01d78e5162125ebfb751f441a113a6b3f1a9950384e740965cd4cb9201e2644231f275ee55dd89ae74d619b51fb456fe76722017df89e3f545c9611b
6
+ metadata.gz: bd8e925f0f62454bfa59868792ed8b8aa5334ff0033ea2926faf04c715ef93aee58b19f13242ba69a281236bcfd609ea6b571c3a7b600fed68e9fb140a783091
7
+ data.tar.gz: fbd90fd703441b9d20d73f71b51c1587a030b25c75648ff15dadea38bb2b77f507266fe49ae99baf20a6f9f511bda6e4231994b36faed5279dc4c88d15637c32
data/README.md CHANGED
@@ -5,6 +5,25 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
  [![Twitter Follow](https://img.shields.io/twitter/follow/imagekitio?label=Follow&style=social)](https://twitter.com/ImagekitIo)
7
7
 
8
+ Rails SDK for [ImageKit](https://imagekit.io/) that implements the new APIs and interface for performing different file operations.
9
+
10
+ ImageKit is a complete image optimization and transformation solution that comes with and
11
+ [image CDN](https://imagekit.io/features/imagekit-infrastructure) and media storage. It can be integrated with your
12
+ existing infrastructure - storage like AWS s3, web servers, your CDN, and custom domain names, allowing you to deliver
13
+ optimize images in minutes with minimal code changes.
14
+
15
+ Table of contents -
16
+ * [Installation](#Installation)
17
+ * [Initialization](#Initialization)
18
+ * [URL Generation](#URL-generation)
19
+ * [File Upload](#File-Upload)
20
+ * [File Management](#File-Management)
21
+ * [Utility Functions](#Utility-functions)
22
+ * [Sample applications](#Sample-Application)
23
+ * [Support](#Support)
24
+ * [Links](#Links)
25
+
26
+
8
27
  ## Installation
9
28
 
10
29
  If you want to create new rails application, then use this command
@@ -31,25 +50,6 @@ Or install it yourself as:
31
50
  ```
32
51
  $ gem install imagekitio
33
52
  ```
34
- ## Usage
35
-
36
- Rails SDK for [ImageKit](https://imagekit.io/) that implements the new APIs and interface for performing different file operations.
37
-
38
- ImageKit is a complete image optimization and transformation solution that comes with and
39
- [image CDN](https://imagekit.io/features/imagekit-infrastructure) and media storage. It can be integrated with your
40
- existing infrastructure - storage like AWS s3, web servers, your CDN, and custom domain names, allowing you to deliver
41
- optimize images in minutes with minimal code changes.
42
-
43
- Table of contents -
44
- * [Installation](#Installation)
45
- * [Initialization](#Initialization)
46
- * [URL Generation](#URL-generation)
47
- * [File Upload](#File-Upload)
48
- * [File Management](#File-Management)
49
- * [Utility Functions](#Utility-functions)
50
- * [Support](#Support)
51
- * [Links](#Links)
52
-
53
53
 
54
54
  ## Initialization
55
55
 
@@ -82,9 +82,16 @@ def options
82
82
  options={
83
83
  response_fields: 'isPrivateFile, tags',
84
84
  tags: %w[abc def],
85
- use_unique_file_name: false
85
+ use_unique_file_name: false,
86
+ folder: "your_directory/"
86
87
  }
87
88
  end
89
+
90
+ # If you want to set upload dir then you can use following method or you can also use options method.
91
+ # This method shuld return string
92
+ def store_dir
93
+ "your_directory/"
94
+ end
88
95
  ```
89
96
 
90
97
  Then you need to modify your model. for example- if your model name is employee then do these changes
@@ -94,7 +101,6 @@ class Employee < ApplicationRecord
94
101
  attr_accessor :avatar
95
102
  mount_uploader :avatar, AvatarUploader
96
103
  end
97
-
98
104
  ```
99
105
 
100
106
  Get image url:
@@ -456,7 +462,7 @@ imagekitio.phash_distance('a4a65595ac94518b', '7838873e791f8400')
456
462
  # output: 37 (dissimilar images)
457
463
  ```
458
464
 
459
- ## Sample Code Instruction
465
+ ## Sample Application
460
466
  There are two sample apps:
461
467
  * [Rails application using Carrierwave](#Instructions-for-rails-application)
462
468
  * [Plain ruby application](#Instructions-for-ruby-application)
@@ -490,7 +496,6 @@ This sample project are using Sqlite3 database. If you are getting `sqlite3` gem
490
496
  ```ruby
491
497
  bundle exec rake db:migrate
492
498
  ```
493
- This sample project is using Sqlite3 database. If you are getting `sqlite3` gem installation error, then install sqlite3 first then again run `bundle install`.
494
499
 
495
500
  **6. Run your application**
496
501
  ```ruby
@@ -1,5 +1,5 @@
1
1
  module Imagekit
2
2
  module Sdk
3
- VERSION = '1.0.4'
3
+ VERSION = '1.0.5'
4
4
  end
5
5
  end
@@ -29,6 +29,16 @@ module CarrierWave
29
29
  if options!=nil
30
30
  @options=options
31
31
  end
32
+ folder=nil
33
+ begin
34
+ folder=store_dir
35
+ rescue
36
+ end
37
+
38
+ if folder!=nil
39
+ @options[:folder]=folder
40
+ end
41
+
32
42
  if self.file!=nil
33
43
  base64=Base64.encode64(::File.open(self.file.file, "rb").read)
34
44
  resp=@imagekit.upload_file(open(self.file.file,'rb'),self.file.filename,@options)
@@ -65,8 +75,12 @@ module CarrierWave
65
75
  def options
66
76
  options={}
67
77
  end
78
+
79
+ def store_dir
80
+ store_dir=nil
81
+ end
68
82
  end
69
83
 
70
84
  end
71
85
 
72
- end
86
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imagekitio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ImageKit.io team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-22 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave