imagegallery2017 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data/lib/imagegallery2017.rb +132 -0
- data.tar.gz.sig +0 -0
- metadata +108 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c64866d24daa270f45c2d7386f42e0220a234ea6
|
4
|
+
data.tar.gz: d06228379b691a7e07d96bd0d2877e5aa7d73980
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea97d10774269fb72314f9f2ee984b01b0854c9596f73d528127ae8d0e2f8c8eb4f65237c4b306820e1f34cac9bfc231c261b14832f47c42a996562ab4962043
|
7
|
+
data.tar.gz: 9eac57300a679e1ca246c26d2c48dddbb43a53f769bd927530ba4b2e6ab556121d0d314deb0acf43cc59da7d3815f060e81ae64527044113548d4d404e46f6d8
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
����ԂS*5)���o'�9�j|+��-���<�ۧ͘��W�5��J��$оC�ޕݥ�N���9w���Y��.@�������ux��t6�!�
|
@@ -0,0 +1,132 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: imagegallery2017.rb
|
4
|
+
|
5
|
+
# description: This is just a personal project on how I'm building an
|
6
|
+
# image gallery which uses XML to store filenames and an
|
7
|
+
# external DRb service to process images. It's designed
|
8
|
+
# to be used with Rack.
|
9
|
+
|
10
|
+
require 'dynarex'
|
11
|
+
require 'nokogiri'
|
12
|
+
require 'fileutils'
|
13
|
+
|
14
|
+
|
15
|
+
class ImageGallery2017
|
16
|
+
|
17
|
+
class Gallery < Dynarex
|
18
|
+
|
19
|
+
attr_reader :folder
|
20
|
+
|
21
|
+
def initialize(rsc, filepath: '.', xslfile: 'index.xslt',
|
22
|
+
schema: nil, title: nil)
|
23
|
+
|
24
|
+
@rsc = rsc
|
25
|
+
@wwwpath = File.join(filepath, 'www')
|
26
|
+
@xslfile = xslfile
|
27
|
+
|
28
|
+
@folder = ''
|
29
|
+
|
30
|
+
a = [@wwwpath, 'images']
|
31
|
+
|
32
|
+
if title then
|
33
|
+
|
34
|
+
@folder = title.downcase.gsub(/\W/,'-').gsub(/-{2,}/,'-')\
|
35
|
+
.gsub(/^-|-$/,'')
|
36
|
+
|
37
|
+
a << @folder
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
@imagespath = File.join(*a)
|
42
|
+
|
43
|
+
FileUtils.mkdir_p @imagespath
|
44
|
+
|
45
|
+
dxfilepath = File.join(@imagespath, 'dynarex.xml')
|
46
|
+
|
47
|
+
if schema then
|
48
|
+
|
49
|
+
super(schema)
|
50
|
+
self.order = :descending
|
51
|
+
self.title = title || 'Image gallery'
|
52
|
+
self.summary[:folder] = @folder
|
53
|
+
self.save dxfilepath
|
54
|
+
|
55
|
+
else
|
56
|
+
super(dxfilepath)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_entry(uploaded)
|
62
|
+
|
63
|
+
filename = uploaded[:filename]
|
64
|
+
file = File.join(@imagespath, filename)
|
65
|
+
File.write file, uploaded[:tempfile].read
|
66
|
+
|
67
|
+
preview_file, desktop_file = @rsc.rmagick.resize file,
|
68
|
+
['140x110','640x480']
|
69
|
+
|
70
|
+
h = {original: filename, desktop: desktop_file,
|
71
|
+
preview: preview_file}
|
72
|
+
|
73
|
+
self.create(h)
|
74
|
+
self.save
|
75
|
+
end
|
76
|
+
|
77
|
+
def render()
|
78
|
+
|
79
|
+
doc = Nokogiri::XML(self.to_xml)
|
80
|
+
xslt = Nokogiri::XSLT(File.read(File.join(@wwwpath, @xslfile)))
|
81
|
+
xslt.transform(doc).to_s
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
class IndexGallery < Gallery
|
88
|
+
|
89
|
+
def initialize(rsc, filepath: '.')
|
90
|
+
|
91
|
+
FileUtils.mkdir_p File.join(filepath, 'www','images')
|
92
|
+
FileUtils.mkdir_p File.join(filepath, 'www','xsl')
|
93
|
+
super(rsc, filepath: filepath, schema: 'images[title, folder]/image' +
|
94
|
+
'(original, desktop, preview)')
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
def modify_entry(id)
|
99
|
+
#self.find_by_id()
|
100
|
+
end
|
101
|
+
|
102
|
+
def render()
|
103
|
+
|
104
|
+
File.write File.join(@wwwpath, 'index.html'), super()
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
attr_reader :index, :gallery
|
111
|
+
|
112
|
+
def initialize(rsc, basepath='.')
|
113
|
+
|
114
|
+
@basepath, @rsc = basepath, rsc
|
115
|
+
@index = IndexGallery.new rsc, filepath: @basepath
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_entry(params)
|
120
|
+
@index.add_entry params
|
121
|
+
end
|
122
|
+
|
123
|
+
def create_folder(title)
|
124
|
+
|
125
|
+
fg = Gallery.new @rsc, schema: 'images[title, folder]/image(original, ' +
|
126
|
+
'desktop, preview)', filepath: @basepath, title: title,
|
127
|
+
xslfile: 'images.xsl'
|
128
|
+
|
129
|
+
@gallery[fg.folder] = fg
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: imagegallery2017
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAc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gAfXd
|
29
|
+
VtjDcJZdilPhknIADvLv9qNsiu07DqyJWpZ587QoYlnRcFUT/rDTLBAejpWB/8ke
|
30
|
+
9SEtob04Aw9pQ6JhqOzpltW5VbIWL0sLsrrRaOFnF4Y/l5DtzcJu5rd0DlduLpbj
|
31
|
+
VTkGIYZRz9NszbK5QM45fZIG1TtUO/QILU1lyb56RusdsPUAQy5qdHcWSkqbU1i4
|
32
|
+
pVP5LTt/M0l+og==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2017-11-26 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: dynarex
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.7'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.7.26
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.7'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.7.26
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: nokogiri
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.8'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.8.1
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.8'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.8.1
|
76
|
+
description:
|
77
|
+
email: james@jamesrobertson.eu
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- lib/imagegallery2017.rb
|
83
|
+
homepage: https://github.com/jrobertson/imagegallery2017
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.6.13
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: An experimental personal project to build a basic ImageGallery. Uses an external
|
107
|
+
object for processing images sizes.
|
108
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
B��$��@�]��K�1}- �L!o�`�Wt�b����2ꐁ�c'��u���!�F8x��02�����[AY��I�)S�!;��*ҕ6��+V��BF��y�ۇ�`����]$Y?>�4��ØBz�s|+KP��jV��٬s�0r8�o�w�����W�P���}��]�A��`A ��W@s}p`_�q`�ȶ���W��ZuF�R�p�͐�$��oU-���Mt�/�^?�z�q���/�E|9�&��ȑ�
|