blurred_image_tag 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d30dd20bfad9d09db6fc1f1ae5776eb7b3149655
4
+ data.tar.gz: 01f07c1ad79c6b3cff5dde2e4448b0980e2a490e
5
+ SHA512:
6
+ metadata.gz: c0655f9a168c29c83e523dfbbe41941e66142efdb7d640577d7c877a3c7ade61edb79ba999adba9e6dc60672ea0743036aa45d6043dec3ac1700107077b19253
7
+ data.tar.gz: d2c7cb1850d5b20e169879a14494028d8a90c491d96083e9612d6d1f2a0887b8198320536e4a7bfbc4a1831e8556d68ba723aa0420c1af011871e7c54fa788b5
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Alex Eguia
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # BlurredImageTag
2
+
3
+ TODO: Write a gem description
4
+ *= require blurred_image_tag
5
+ gem 'blurred_image_tag'
6
+ blurred_image_tag 'missing.png'
7
+ parent div the width you want
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'blurred_image_tag'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install blurred_image_tag
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it ( https://github.com/[my-github-username]/blurred_image_tag/fork )
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,36 @@
1
+ .blurred-image-wrapper {
2
+ position: relative;
3
+ display: block;
4
+ width: 100%;
5
+ height: 0;
6
+ padding-top: 100%;
7
+ overflow: hidden;
8
+ background: transparent;
9
+ }
10
+
11
+ .blurred-image-wrapper img.blurred {
12
+ position: absolute;
13
+ display: block;
14
+ width: 100%;
15
+ height: 100%;
16
+ left: 0;
17
+ right: 0;
18
+ top: 0;
19
+ bottom: 0;
20
+ margin: auto;
21
+ filter: blur(5px) opacity(0.25);
22
+ -webkit-filter: blur(5px) opacity(0.25);
23
+ transform: scale(1.1);
24
+ }
25
+
26
+ .blurred-image-wrapper img.original {
27
+ position: absolute;
28
+ display: block;
29
+ max-width: 100%;
30
+ max-height: 100%;
31
+ left: 0;
32
+ right: 0;
33
+ top: 0;
34
+ bottom: 0;
35
+ margin: auto;
36
+ }
@@ -0,0 +1,18 @@
1
+ module BlurredImageTagHelper
2
+ def blurred_image_tag(source, options = {})
3
+ # Add internal class name to coming classes
4
+ original_classes = [options[:class], 'original'].join(' ')
5
+ blurred_classes = [options[:class], 'blurred'].join(' ')
6
+
7
+ # Retrieve width and heigth of the image, 100% by default
8
+ width = options[:width].nil? ? '100%' : options[:width]
9
+ heigth = options[:height].nil? ? '100%' : options[:height]
10
+
11
+ # Generate parent div with two images, one blurred and the original non-blurred one on top
12
+ output = '<div class="blurred-image-wrapper" style="width: ' + width + '; padding-top: ' + heigth + '">'
13
+ output += image_tag source, options.merge(class: blurred_classes).except(:width).except(:heigth)
14
+ output += image_tag source, options.merge(class: original_classes).except(:width).except(:heigth)
15
+ output += '</div>'
16
+ output.html_safe
17
+ end
18
+ end
@@ -0,0 +1,2 @@
1
+ require "blurred_image_tag/version"
2
+ require "blurred_image_tag/engine"
@@ -0,0 +1,4 @@
1
+ module BlurredImageTag
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module BlurredImageTag
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blurred_image_tag
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - KRaikk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ description:
28
+ email:
29
+ - alex@alexeguia.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - LICENSE.txt
35
+ - README.md
36
+ - Rakefile
37
+ - app/assets/stylesheets/blurred_image_tag.css
38
+ - app/helpers/blurred_image_tag_helper.rb
39
+ - lib/blurred_image_tag.rb
40
+ - lib/blurred_image_tag/engine.rb
41
+ - lib/blurred_image_tag/version.rb
42
+ homepage: https://github.com/KRaikk/blurred_image_tag
43
+ licenses:
44
+ - MIT
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.2.2
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Generates a div with a given image with a blurred background keeping its
66
+ aspect ratio.
67
+ test_files: []