el_finder 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/el_finder/connector.rb +9 -5
- data/lib/el_finder/version.rb +1 -1
- data/test/test_el_finder_thumbs.rb +3 -3
- metadata +6 -6
data/lib/el_finder/connector.rb
CHANGED
@@ -75,12 +75,12 @@ module ElFinder
|
|
75
75
|
|
76
76
|
#
|
77
77
|
def to_hash(pathname)
|
78
|
-
Base64.encode64(pathname.path.to_s).chomp
|
78
|
+
Base64.encode64(pathname.path.to_s).chomp.tr("\n", "_")
|
79
79
|
end # of to_hash
|
80
80
|
|
81
81
|
#
|
82
82
|
def from_hash(hash)
|
83
|
-
pathname = @root + Base64.decode64(hash)
|
83
|
+
pathname = @root + Base64.decode64(hash.tr("_", "\n"))
|
84
84
|
end # of from_hash
|
85
85
|
|
86
86
|
#
|
@@ -349,14 +349,18 @@ module ElFinder
|
|
349
349
|
else
|
350
350
|
@response[:current] = to_hash(@current)
|
351
351
|
@response[:images] = {}
|
352
|
-
|
352
|
+
idx = 0
|
353
|
+
@current.children.select{|e| mime_handler.for(e) =~ /image/}.each do |img|
|
353
354
|
if idx >= @options[:thumbs_at_once]
|
354
355
|
@response[:tmb] = true
|
355
356
|
break
|
356
357
|
end
|
357
358
|
thumbnail = thumbnail_for(img)
|
358
|
-
|
359
|
-
|
359
|
+
unless thumbnail.file?
|
360
|
+
image_handler.thumbnail(img, thumbnail, :width => @options[:thumbs_size].to_i, :height => @options[:thumbs_size].to_i)
|
361
|
+
@response[:images][to_hash(img)] = @options[:url] + '/' + thumbnail.path.to_s
|
362
|
+
idx += 1
|
363
|
+
end
|
360
364
|
end
|
361
365
|
end
|
362
366
|
|
data/lib/el_finder/version.rb
CHANGED
@@ -72,7 +72,7 @@ class TestElFinderThumbs < Test::Unit::TestCase
|
|
72
72
|
h, r = @elfinder.run(:cmd => 'tmb', :current => '')
|
73
73
|
|
74
74
|
elfinder_hash = @elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'elfinder.png'))
|
75
|
-
pjkh_hash = @elfinder.to_hash(ElFinder::Pathname.new(@vroot, '
|
75
|
+
pjkh_hash = @elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'pjkh.png'))
|
76
76
|
|
77
77
|
assert_equal 2, r[:images].size
|
78
78
|
assert_equal "/elfinder/.thumbs/#{elfinder_hash}.png", r[:images][elfinder_hash]
|
@@ -85,7 +85,7 @@ class TestElFinderThumbs < Test::Unit::TestCase
|
|
85
85
|
h, r = @elfinder.run(:cmd => 'tmb', :current => '')
|
86
86
|
|
87
87
|
elfinder_hash = @elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'elfinder.png'))
|
88
|
-
pjkh_hash = @elfinder.to_hash(ElFinder::Pathname.new(@vroot, '
|
88
|
+
pjkh_hash = @elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'pjkh.png'))
|
89
89
|
|
90
90
|
assert_equal true, r[:tmb]
|
91
91
|
assert_equal 1, r[:images].size
|
@@ -93,7 +93,7 @@ class TestElFinderThumbs < Test::Unit::TestCase
|
|
93
93
|
|
94
94
|
def test_thumbnail_removed_when_image_removed
|
95
95
|
@elfinder.options = { :thumbs => true }
|
96
|
-
pjkh_thumb = File.join(@vroot, '.thumbs', "#{@elfinder.to_hash(ElFinder::Pathname.new(@vroot, '
|
96
|
+
pjkh_thumb = File.join(@vroot, '.thumbs', "#{@elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'pjkh.png'))}.png")
|
97
97
|
elfinder_thumb = File.join(@vroot, '.thumbs', "#{@elfinder.to_hash(ElFinder::Pathname.new(@vroot, 'elfinder.png'))}.png")
|
98
98
|
Dir.mkdir(File.join(@vroot, '.thumbs'))
|
99
99
|
FileUtils.touch pjkh_thumb
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: el_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 10
|
10
|
+
version: 1.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Philip Hallstrom
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-02 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
106
106
|
- ImageMagick
|
107
107
|
rubyforge_project: el_finder
|
108
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 1.5.2
|
109
109
|
signing_key:
|
110
110
|
specification_version: 3
|
111
111
|
summary: elFinder server side connector for Ruby.
|