m1key_gallery_generator 0.3.5 → 0.3.8
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 +4 -4
- data/README.md +3 -3
- data/bin/console +1 -1
- data/lib/m1key_gallery_generator/gallery_config.rb +3 -1
- data/lib/m1key_gallery_generator/photos_utils.rb +3 -2
- data/lib/m1key_gallery_generator/template.erb +53 -10
- data/lib/m1key_gallery_generator/version.rb +1 -1
- data/lib/m1key_gallery_generator/viewable_gallery.rb +6 -4
- data/lib/m1key_gallery_generator/viewable_photo_metadata.rb +3 -2
- data/m1key_gallery_generator.gemspec +2 -1
- metadata +21 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a30358754706ef9405263138b5c0336ad16ac466361ab64acf68ac929647f9e8
|
|
4
|
+
data.tar.gz: f96b1c652c1b55d90fc403be53bfa39b3c52566b91e1d21e670bb9b3b3e5a420
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c73d2e4e88ed2bd16640d2756eb7f2fd6ce11e2e165d0b92e0ecde827ea50fd6fd4e8ef75653860ebabdb53c00731365b455e7e3e9f91ef329b64a61fd314863
|
|
7
|
+
data.tar.gz: 482256bbb2965cfd30882d912e1895c0ece6c6b7df0208ae3bd9e18f0ad324a828dbc3f8bcfe99849e9e3c75c00c81b7231e755ee975712807d064a9dd3d705c
|
data/README.md
CHANGED
|
@@ -74,11 +74,11 @@ Build the gem.
|
|
|
74
74
|
|
|
75
75
|
Install the gem.
|
|
76
76
|
|
|
77
|
-
> gem install m1key_gallery_generator-0.3.
|
|
77
|
+
> gem install m1key_gallery_generator-0.3.8.gem
|
|
78
78
|
|
|
79
79
|
In your gallery directory, have a file called generate.bat that looks like this:
|
|
80
80
|
|
|
81
|
-
> ruby c:\Ruby34-x64\lib\ruby\gems\3.4.0\gems\m1key_gallery_generator-0.3.
|
|
81
|
+
> ruby c:\Ruby34-x64\lib\ruby\gems\3.4.0\gems\m1key_gallery_generator-0.3.8\bin\console . wait_on_error
|
|
82
82
|
|
|
83
83
|
## Development
|
|
84
84
|
|
|
@@ -95,7 +95,7 @@ To build gem:
|
|
|
95
95
|
> gem build m1key_gallery_generator.gemspec
|
|
96
96
|
|
|
97
97
|
To install gem:
|
|
98
|
-
> gem install m1key_gallery_generator-0.3.
|
|
98
|
+
> gem install m1key_gallery_generator-0.3.8.gem
|
|
99
99
|
|
|
100
100
|
To test gem:
|
|
101
101
|
> irb
|
data/bin/console
CHANGED
|
@@ -31,7 +31,7 @@ begin
|
|
|
31
31
|
|
|
32
32
|
gallery = ViewableGallery.new(gallery_config.title, gallery_config.description, gallery_config.slug,
|
|
33
33
|
gallery_config.sources, gallery_config.upload_date, gallery_config.map_url, gallery_config.map_title,
|
|
34
|
-
gallery_config.year, viewable_photos, gallery_config.small_print).
|
|
34
|
+
gallery_config.year, viewable_photos, gallery_config.small_print, gallery_config.blurb).
|
|
35
35
|
update_using(
|
|
36
36
|
add_tabs_before_every_description_line(3),
|
|
37
37
|
add_links_to_descriptions,
|
|
@@ -5,7 +5,7 @@ require_relative 'console_utils'
|
|
|
5
5
|
module GalleryGenerator
|
|
6
6
|
class GalleryConfig
|
|
7
7
|
|
|
8
|
-
attr_reader :title, :map_url, :map_title, :slug, :upload_date, :description, :sources, :year, :photos, :small_print
|
|
8
|
+
attr_reader :title, :map_url, :map_title, :slug, :upload_date, :description, :sources, :year, :photos, :small_print, :blurb
|
|
9
9
|
|
|
10
10
|
def initialize(yaml_config_file_name)
|
|
11
11
|
puts "Attempting to parse #{yaml_config_file_name} to read gallery configuration..."
|
|
@@ -27,6 +27,8 @@ module GalleryGenerator
|
|
|
27
27
|
puts "Gallery description is [#{compact(@description)}]."
|
|
28
28
|
@small_print = gallery_configuration['small_print']
|
|
29
29
|
puts "Small print is [#{@small_print}]."
|
|
30
|
+
@blurb = gallery_configuration['blurb']
|
|
31
|
+
puts "Gallery description is [#{compact(@blurb)}]."
|
|
30
32
|
|
|
31
33
|
@sources = gallery_configuration['sources']
|
|
32
34
|
|
|
@@ -19,7 +19,7 @@ module GalleryGenerator
|
|
|
19
19
|
photo_technical_info = photo['technicalInfo']
|
|
20
20
|
photo_metadata = get_metadata_for_image_with_file_name_containing(working_directory, photo_file_name_contains)
|
|
21
21
|
|
|
22
|
-
puts "Adding photo with ID [#{photo_id}], title [#{photo_title}], height [#{photo_metadata.height}], description [#{compact(photo['description'])}]..."
|
|
22
|
+
puts "Adding photo with ID [#{photo_id}], title [#{photo_title}], width [#{photo_metadata.width}], height [#{photo_metadata.height}], description [#{compact(photo['description'])}]..."
|
|
23
23
|
photos.push ViewablePhoto.new(photo_id, photo_title, photo_description, photo_metadata, photo_technical_info)
|
|
24
24
|
|
|
25
25
|
create_gallery_image(photo_metadata.original_file_name, gallery_config.slug, photo_id, working_directory)
|
|
@@ -37,12 +37,13 @@ module GalleryGenerator
|
|
|
37
37
|
raise "ERROR No matching photo found for #{file_name_contains}." unless selected_file_name
|
|
38
38
|
|
|
39
39
|
exif = EXIFR::JPEG.new(File.join(working_directory, selected_file_name))
|
|
40
|
+
photo_width = exif.width
|
|
40
41
|
photo_height = exif.height
|
|
41
42
|
photo_iso = exif.iso_speed_ratings
|
|
42
43
|
photo_focal_length = exif.focal_length.to_f.round.to_s
|
|
43
44
|
photo_f_number = exif.f_number.to_f
|
|
44
45
|
photo_exposure_time = exif.exposure_time.to_s
|
|
45
|
-
ViewablePhotoMetadata.new(selected_file_name, photo_height, photo_iso, photo_focal_length, photo_f_number, photo_exposure_time)
|
|
46
|
+
ViewablePhotoMetadata.new(selected_file_name, photo_width, photo_height, photo_iso, photo_focal_length, photo_f_number, photo_exposure_time)
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
def create_gallery_image(original_file_name, gallery_slug, photo_id, working_directory)
|
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
7
7
|
<title><%= title %> — Photography and Art Portfolio by Michal Huniewicz</title>
|
|
8
|
-
<meta name="description" content="<%=
|
|
8
|
+
<meta name="description" content="<%= blurb %>" />
|
|
9
|
+
<link rel="canonical" href="https://www.m1key.me/photography/<%= slug %>" />
|
|
9
10
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
11
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
12
|
+
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
|
|
13
|
+
<link rel="dns-prefetch" href="https://fonts.gstatic.com" />
|
|
11
14
|
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@800;900&display=swap" rel="stylesheet" />
|
|
15
|
+
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;500;600;700&display=swap"
|
|
16
|
+
rel="preload" as="style" />
|
|
12
17
|
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;500;600;700&display=swap"
|
|
13
18
|
rel="stylesheet" />
|
|
14
19
|
<link rel="stylesheet" href="../../styles/base_responsive.css" />
|
|
@@ -17,14 +22,14 @@
|
|
|
17
22
|
<meta property="og:locale" content="en_US" />
|
|
18
23
|
<meta property="og:type" content="website" />
|
|
19
24
|
<meta property="og:title" content="<%= title %> by Michal Huniewicz" />
|
|
20
|
-
<meta property="og:description" content="<%=
|
|
21
|
-
<meta property="og:url" content="https://www.m1key.me/" />
|
|
25
|
+
<meta property="og:description" content="<%= blurb %>" />
|
|
26
|
+
<meta property="og:url" content="https://www.m1key.me/photography/<%= slug %>" />
|
|
22
27
|
<meta property="og:image" content="https://www.m1key.me/photography/<%= slug %>/<%= slug %>_01.jpg" />
|
|
23
28
|
<meta property="og:image:alt" content="<%= title %> by Michal Huniewicz" />
|
|
24
29
|
|
|
25
30
|
<meta name="twitter:card" content="summary_large_image" />
|
|
26
31
|
<meta name="twitter:title" content="<%= title %> by Michal Huniewicz" />
|
|
27
|
-
<meta name="twitter:description" content="<%=
|
|
32
|
+
<meta name="twitter:description" content="<%= blurb %>" />
|
|
28
33
|
<meta name="twitter:image" content="https://www.m1key.me/photography/<%= slug %>/<%= slug %>_01.jpg" />
|
|
29
34
|
|
|
30
35
|
<!-- Breadcrumb structured data for SEO -->
|
|
@@ -34,7 +39,14 @@
|
|
|
34
39
|
"@type": "ImageGallery",
|
|
35
40
|
"name": "<%= title %> by Michal Huniewicz",
|
|
36
41
|
"url": "https://www.m1key.me/photography/<%= slug %>",
|
|
42
|
+
"datePublished": "<%= upload_date %>",
|
|
43
|
+
"dateModified": "<%= upload_date %>",
|
|
37
44
|
"author": {
|
|
45
|
+
"@type": "Person",
|
|
46
|
+
"name": "Michal Huniewicz",
|
|
47
|
+
"url": "https://www.m1key.me/"
|
|
48
|
+
},
|
|
49
|
+
"publisher": {
|
|
38
50
|
"@type": "Person",
|
|
39
51
|
"name": "Michal Huniewicz"
|
|
40
52
|
},
|
|
@@ -42,11 +54,41 @@
|
|
|
42
54
|
{
|
|
43
55
|
"@type": "ImageObject",
|
|
44
56
|
"contentUrl" : "https://www.m1key.me/photography/<%= slug %>/<%= slug %>_<%= photo.id %>.jpg",
|
|
45
|
-
"caption": "<%= photo.title %>"
|
|
57
|
+
"caption": "<%= photo.title %>",
|
|
58
|
+
"width": <%= photo.metadata.width %>,
|
|
59
|
+
"height": <%= photo.metadata.height %>
|
|
46
60
|
}<% if (index + 1) == photos.size %><% else %>,<% end -%>
|
|
47
61
|
<% end %>
|
|
48
62
|
],
|
|
49
|
-
"description": "<%=
|
|
63
|
+
"description": "<%= blurb %>",
|
|
64
|
+
"keywords": "photography, art, portfolio, Michal Huniewicz, m1key.me, <%= title %>"
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<script type="application/ld+json">
|
|
69
|
+
{
|
|
70
|
+
"@context": "https://schema.org",
|
|
71
|
+
"@type": "BreadcrumbList",
|
|
72
|
+
"itemListElement": [
|
|
73
|
+
{
|
|
74
|
+
"@type": "ListItem",
|
|
75
|
+
"position": 1,
|
|
76
|
+
"name": "Home",
|
|
77
|
+
"item": "https://www.m1key.me/"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"@type": "ListItem",
|
|
81
|
+
"position": 2,
|
|
82
|
+
"name": "Photography",
|
|
83
|
+
"item": "https://www.m1key.me/photography/"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"@type": "ListItem",
|
|
87
|
+
"position": 3,
|
|
88
|
+
"name": "<%= title %>",
|
|
89
|
+
"item": "https://www.m1key.me/photography/<%= slug %>"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
50
92
|
}
|
|
51
93
|
</script>
|
|
52
94
|
</head>
|
|
@@ -81,13 +123,14 @@
|
|
|
81
123
|
</a>
|
|
82
124
|
<figcaption class="visually-hidden">Map showing <%= map_title %> location (opens in OpenStreetMap)</figcaption>
|
|
83
125
|
</figure>
|
|
84
|
-
<% photos.
|
|
126
|
+
<% photos.each_with_index do |photo, index| %>
|
|
85
127
|
<article class="photo" id="<%= photo.id %>">
|
|
86
128
|
<header>
|
|
87
129
|
<h2 class="title"><a href="#<%= photo.id %>" title="Link to this photo"><%= photo.title %></a></h2>
|
|
88
130
|
</header>
|
|
89
131
|
<figure class="image-container">
|
|
90
|
-
<img src="<%= slug %>_<%= photo.id %>.jpg" alt="<%= photo.title %>" loading="lazy"
|
|
132
|
+
<img src="<%= slug %>_<%= photo.id %>.jpg" alt="<%= photo.title %>" <% if index == 0 %>loading="eager" fetchpriority="high"<% else %>loading="lazy"<% end %>
|
|
133
|
+
width="<%= photo.metadata.width %>" height="<%= photo.metadata.height %>" />
|
|
91
134
|
<figcaption>
|
|
92
135
|
<span class="description"><%= photo.description %></span>
|
|
93
136
|
<span class="technical">ISO <%= photo.metadata.iso %>, <%= photo.metadata.focal_length %>mm, f/<%= photo.metadata.f_number %>, <%= photo.metadata.exposure_time %>s.<% if photo.technical_info.to_s != '' %> <%= photo.technical_info %><% end %></span>
|
|
@@ -96,7 +139,7 @@
|
|
|
96
139
|
</article>
|
|
97
140
|
<% end %>
|
|
98
141
|
<details class="sources" id="sources">
|
|
99
|
-
<summary
|
|
142
|
+
<summary>Sources</summary>
|
|
100
143
|
<ul class="smallprint"><% sources.each_with_index do |source, index| %>
|
|
101
144
|
<li><%= index + 1 %>: <a href="<%= source %>" rel="noopener noreferrer" class="nav-link"><%= source %></a></li><% end %>
|
|
102
145
|
</ul>
|
|
@@ -118,7 +161,7 @@
|
|
|
118
161
|
<li><a href="https://www.m1key.me" class="nav-link">M1key.me</a></li>
|
|
119
162
|
<li><a href="https://www.m1key.me/photography/" class="nav-link">Photography</a></li>
|
|
120
163
|
<li><a href="https://www.m1key.me/about_me/" class="nav-link">About me</a></li>
|
|
121
|
-
<li><a href="https://www.flickr.com/photos/m1key-me/" rel="noopener noreferrer" class="nav-link">Flickr</a></li>
|
|
164
|
+
<li><a href="https://www.flickr.com/photos/m1key-me/" target="_blank" rel="noopener noreferrer" class="nav-link">Flickr</a></li>
|
|
122
165
|
</ul>
|
|
123
166
|
</nav>
|
|
124
167
|
|
|
@@ -2,8 +2,8 @@ require_relative 'string_utils'
|
|
|
2
2
|
|
|
3
3
|
module GalleryGenerator
|
|
4
4
|
class ViewableGallery
|
|
5
|
-
attr_reader :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print
|
|
6
|
-
def initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print)
|
|
5
|
+
attr_reader :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb
|
|
6
|
+
def initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print, blurb)
|
|
7
7
|
@title = String.new(title)
|
|
8
8
|
@description = description
|
|
9
9
|
@slug = slug
|
|
@@ -14,6 +14,7 @@ module GalleryGenerator
|
|
|
14
14
|
@year = year
|
|
15
15
|
@photos = viewable_photos
|
|
16
16
|
@small_print = small_print
|
|
17
|
+
@blurb = blurb
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def get_binding
|
|
@@ -29,7 +30,7 @@ module GalleryGenerator
|
|
|
29
30
|
|
|
30
31
|
ViewableGallery.new(updated_gallery.title, updated_gallery.description, updated_gallery.slug,
|
|
31
32
|
updated_gallery.sources, updated_gallery.upload_date, updated_gallery.map_url,
|
|
32
|
-
updated_gallery.map_title, updated_gallery.year, to_viewable_photos(updated_gallery.photos), updated_gallery.small_print)
|
|
33
|
+
updated_gallery.map_title, updated_gallery.year, to_viewable_photos(updated_gallery.photos), updated_gallery.small_print, updated_gallery.blurb)
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
def to_viewable_photos(mutable_viewable_photos)
|
|
@@ -41,7 +42,7 @@ module GalleryGenerator
|
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
class MutableViewableGallery
|
|
44
|
-
attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print
|
|
45
|
+
attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb
|
|
45
46
|
def initialize(viewable_gallery)
|
|
46
47
|
@title = viewable_gallery.title
|
|
47
48
|
@description = viewable_gallery.description
|
|
@@ -53,6 +54,7 @@ module GalleryGenerator
|
|
|
53
54
|
@year = viewable_gallery.year
|
|
54
55
|
@photos = to_mutable_viewable_photos(viewable_gallery.photos)
|
|
55
56
|
@small_print = viewable_gallery.small_print
|
|
57
|
+
@blurb = viewable_gallery.blurb
|
|
56
58
|
end
|
|
57
59
|
|
|
58
60
|
def to_mutable_viewable_photos(viewable_photos)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
module GalleryGenerator
|
|
2
2
|
class ViewablePhotoMetadata
|
|
3
|
-
attr_reader :original_file_name, :height, :iso, :focal_length, :f_number, :exposure_time
|
|
4
|
-
def initialize(original_file_name, height, iso, focal_length, f_number, exposure_time)
|
|
3
|
+
attr_reader :original_file_name, :width, :height, :iso, :focal_length, :f_number, :exposure_time
|
|
4
|
+
def initialize(original_file_name, width, height, iso, focal_length, f_number, exposure_time)
|
|
5
5
|
@original_file_name = original_file_name
|
|
6
|
+
@width = width
|
|
6
7
|
@height = height
|
|
7
8
|
@iso = iso
|
|
8
9
|
@focal_length = focal_length
|
|
@@ -23,8 +23,9 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
|
|
24
24
|
spec.add_runtime_dependency 'exifr', '~> 1.4', '>= 1.4.0'
|
|
25
25
|
|
|
26
|
-
spec.add_development_dependency 'bundler', '>= 2.4.10'
|
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.4', '>= 2.4.10'
|
|
27
27
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
28
28
|
spec.add_development_dependency 'minitest', '~> 5.15'
|
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.13'
|
|
30
|
+
spec.add_development_dependency 'fiddle', '~> 1.1.8'
|
|
30
31
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: m1key_gallery_generator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michal Huniewicz
|
|
@@ -33,6 +33,9 @@ dependencies:
|
|
|
33
33
|
name: bundler
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
|
35
35
|
requirements:
|
|
36
|
+
- - "~>"
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '2.4'
|
|
36
39
|
- - ">="
|
|
37
40
|
- !ruby/object:Gem::Version
|
|
38
41
|
version: 2.4.10
|
|
@@ -40,6 +43,9 @@ dependencies:
|
|
|
40
43
|
prerelease: false
|
|
41
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
42
45
|
requirements:
|
|
46
|
+
- - "~>"
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '2.4'
|
|
43
49
|
- - ">="
|
|
44
50
|
- !ruby/object:Gem::Version
|
|
45
51
|
version: 2.4.10
|
|
@@ -85,6 +91,20 @@ dependencies:
|
|
|
85
91
|
- - "~>"
|
|
86
92
|
- !ruby/object:Gem::Version
|
|
87
93
|
version: '3.13'
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
name: fiddle
|
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - "~>"
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: 1.1.8
|
|
101
|
+
type: :development
|
|
102
|
+
prerelease: false
|
|
103
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
104
|
+
requirements:
|
|
105
|
+
- - "~>"
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: 1.1.8
|
|
88
108
|
description: This gem allows you to generate a m1key.me-style gallery based on the
|
|
89
109
|
JPG files in the working directory.
|
|
90
110
|
email:
|