refile_images 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/image.rb +26 -0
- data/lib/refile_images/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dd1635a7a06726fd24becb089673870e4e58436
|
4
|
+
data.tar.gz: 31cb361ea5ecfb87853205869977da9f97111591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb7da098860a48eccb90ea7b88714f0501bb7b62d916c94dc757b8aab726b03a3fa09d9605bdcbc0fed9b9b0d35e92966563596d4e35263b3e4d0a574c5ebbc6
|
7
|
+
data.tar.gz: 5f4760b8139f7814d7e0f16850494117f2115b949b7eaf0e7e7ba0d8f8fbf7116a71d45abd92bd6c60ba0e0a8790ad5ab5f7face03ab5ef082bbda81dfaa43f1
|
data/app/models/image.rb
CHANGED
@@ -7,4 +7,30 @@ class Image < ActiveRecord::Base
|
|
7
7
|
def url(size, *options)
|
8
8
|
imageable.get_url(self, size, *options)
|
9
9
|
end
|
10
|
+
|
11
|
+
|
12
|
+
# Generate a custom image URL.
|
13
|
+
#
|
14
|
+
# If the filename option is not given, the filename is taken from the
|
15
|
+
# metadata stored in the attachment, or eventually falls back to the
|
16
|
+
# `name`.
|
17
|
+
#
|
18
|
+
# The host defaults to {Refile.cdn_host}, which is useful for serving all
|
19
|
+
# attachments from a CDN. You can also override the host via the `host`
|
20
|
+
# option.
|
21
|
+
#
|
22
|
+
# @example original image url
|
23
|
+
# image.custom_url
|
24
|
+
#
|
25
|
+
# @example With custom params
|
26
|
+
# image.attachment_url(:fill, 300, 300, format: :jpg, filename: "awesome")
|
27
|
+
#
|
28
|
+
# @param [String, nil] filename The filename to be appended to the URL
|
29
|
+
# @param [String, nil] format A file extension to be appended to the URL
|
30
|
+
# @param [String, nil] host Override the host
|
31
|
+
# @param [String, nil] prefix Adds a prefix to the URL if the application is not mounted at root
|
32
|
+
# @return [String, nil] The generated URL
|
33
|
+
def custom_url(*args, **options)
|
34
|
+
Refile.attachment_url(self, :file, *args, **options)
|
35
|
+
end
|
10
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refile_images
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Barragán
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|