el_finder 1.0.8 → 1.0.9

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.
@@ -457,11 +457,17 @@ module ElFinder
457
457
  )
458
458
 
459
459
  if pathname.readable? && response[:mime] =~ /image/ && !image_handler.nil?
460
- @response[:tmb] = true if @options[:thumbs] && !thumbnail_for(pathname).exist?
461
460
  response.merge!(
462
461
  :resize => true,
463
462
  :dim => image_handler.size(pathname)
464
463
  )
464
+ if @options[:thumbs]
465
+ if (thumbnail = thumbnail_for(pathname)).exist?
466
+ response.merge!( :tmb => (@options[:url] + '/' + thumbnail.path.to_s))
467
+ else
468
+ @response[:tmb] = true
469
+ end
470
+ end
465
471
  end
466
472
 
467
473
  end
@@ -1,3 +1,3 @@
1
1
  module ElFinder
2
- VERSION = '1.0.8'
2
+ VERSION = '1.0.9'
3
3
  end
@@ -104,6 +104,22 @@ class TestElFinderThumbs < Test::Unit::TestCase
104
104
 
105
105
  assert !File.exist?(pjkh_thumb)
106
106
  assert !File.exist?(elfinder_thumb)
107
+ end
108
+
109
+ def test_open_response_contains_tmb_details_if_thumbs_exist
110
+ @elfinder.options = { :thumbs => true }
111
+ h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '')
112
+
113
+ r[:cdc].select{|e| e[:mime] =~ /image/}.each do |img|
114
+ assert_nil img[:tmb]
115
+ end
116
+
117
+ h, r = @elfinder.run(:cmd => 'tmb', :current => '')
118
+ h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '')
119
+
120
+ r[:cdc].select{|e| e[:mime] =~ /image/}.each do |img|
121
+ assert_not_nil img[:tmb]
122
+ end
107
123
 
108
124
  end
109
125
 
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: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 8
10
- version: 1.0.8
9
+ - 9
10
+ version: 1.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Philip Hallstrom