artwork 0.0.1 → 0.1.0
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.
- data/README.md +28 -8
- data/artwork.gemspec +3 -3
- data/lib/artwork/version.rb +1 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -1,13 +1,33 @@
|
|
1
1
|
# Artwork
|
2
2
|
|
3
|
-
Automated image size
|
4
|
-
backend. Works for any browser. Delivers the information needed for
|
5
|
-
calculations (browser window's dimentions and device's pixel ratio) via a
|
3
|
+
Automated user-resolution-based image size choosing for your Rails views, but
|
4
|
+
done at the backend. Works for any browser. Delivers the information needed for
|
5
|
+
the calculations (browser window's dimentions and device's pixel ratio) via a
|
6
6
|
cookie. Supports only Paperclip attachments.
|
7
7
|
|
8
|
-
|
8
|
+
## An example
|
9
9
|
|
10
|
-
|
10
|
+
Say you've declared a default (base) resolution of 1440px. You design based on
|
11
|
+
that resolution. You want to show the user an image which is half of the width
|
12
|
+
of the user's browser. You then add the following to your view:
|
13
|
+
|
14
|
+
<%= artwork_tag @post, :cover_image, '720x' %>
|
15
|
+
|
16
|
+
Say you have the following image thumbs prepared (defined with imagemagick
|
17
|
+
geometry strings):
|
18
|
+
|
19
|
+
256x>
|
20
|
+
512x>
|
21
|
+
1024x>
|
22
|
+
2048x>
|
23
|
+
|
24
|
+
Let's also assume a user with a full HD screen opens your page (1920x1080).
|
25
|
+
Then, `artwork_tag` will look for a 960px wide image (which is 50% of 1920px).
|
26
|
+
You don't have that exact size on the server, so the helper will choose the
|
27
|
+
1024px-wide version of the image.
|
28
|
+
|
29
|
+
If the user's screen is retina (ie. with a device-to-pixel ratio > 1.0) and if
|
30
|
+
you have a _2x versions of your thumbs, the helper will choose the _2x one.
|
11
31
|
|
12
32
|
## Installation
|
13
33
|
|
@@ -67,8 +87,8 @@ Configure the gem by putting the following code in `config/initializers/artwork.
|
|
67
87
|
|
68
88
|
Include `Artwork::Model` in your models which have artworks.
|
69
89
|
|
70
|
-
Include `Artwork::
|
71
|
-
to have the artwork functionality.
|
90
|
+
Include `Artwork::Controller` in your `ApplicationController` or wherever you
|
91
|
+
want to have the artwork functionality.
|
72
92
|
|
73
93
|
Then you can use `Artwork.load_2x_images?`, `Artwork.current_resolution` and
|
74
94
|
the `artwork_tag` view helper. Example:
|
@@ -78,7 +98,7 @@ the `artwork_tag` view helper. Example:
|
|
78
98
|
|
79
99
|
## Contributing
|
80
100
|
|
81
|
-
1. Fork it
|
101
|
+
1. [Fork it](https://github.com/mitio/artwork/fork)
|
82
102
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
83
103
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
84
104
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/artwork.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Artwork::VERSION
|
9
9
|
spec.authors = ['Dimitar Dimitrov']
|
10
10
|
spec.email = ['dimitar@live.bg']
|
11
|
-
spec.summary = 'Automated image size
|
12
|
-
spec.description = '
|
13
|
-
spec.homepage = ''
|
11
|
+
spec.summary = 'Automated user resolution based image size choosing for Rails.'
|
12
|
+
spec.description = 'Automated user resolution based image size choosing for your Rails views, but done at the backend.'
|
13
|
+
spec.homepage = 'https://github.com/mitio/artwork'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/artwork/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dimitar Dimitrov
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: "2.3"
|
78
78
|
type: :runtime
|
79
79
|
version_requirements: *id004
|
80
|
-
description:
|
80
|
+
description: Automated user resolution based image size choosing for your Rails views, but done at the backend.
|
81
81
|
email:
|
82
82
|
- dimitar@live.bg
|
83
83
|
executables: []
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- lib/artwork/view.rb
|
105
105
|
- lib/assets/javascripts/artwork.js
|
106
106
|
has_rdoc: true
|
107
|
-
homepage:
|
107
|
+
homepage: https://github.com/mitio/artwork
|
108
108
|
licenses:
|
109
109
|
- MIT
|
110
110
|
post_install_message:
|
@@ -136,6 +136,6 @@ rubyforge_project:
|
|
136
136
|
rubygems_version: 1.6.2
|
137
137
|
signing_key:
|
138
138
|
specification_version: 3
|
139
|
-
summary: Automated image size
|
139
|
+
summary: Automated user resolution based image size choosing for Rails.
|
140
140
|
test_files: []
|
141
141
|
|