uwa_polaroid 0.1

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.
@@ -0,0 +1,18 @@
1
+ require 'uwa'
2
+ require 'RMagick'
3
+
4
+ module UWA
5
+ module Widget
6
+ class Polaroid < UWA::Handler
7
+ NAME = 'uwa_polaroid'
8
+ VERSION = '0.1'
9
+ COPYRIGHT = 'Copyright (C) 2007 Florent Solt'
10
+ DESC = 'UWA Polaroid widget'
11
+ AUTHOR = 'Florent Solt'
12
+ EMAIL = 'florent@solt.biz'
13
+ HOMEPAGE = 'http://gnetvibes.rubyforge.org'
14
+ LICENSE = 'BSD'
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,36 @@
1
+ require 'uwa_polaroid/config'
2
+ require 'digest/sha1'
3
+
4
+ module UWA
5
+ module Widget
6
+ class Polaroid
7
+
8
+ def initialize
9
+ super
10
+ @author = 'Florent Solt'
11
+ @title = 'Polaroid'
12
+ @photo = 'photo.png'
13
+ @dir = File.join(File.dirname(__FILE__), '..', '..', 'ressources')
14
+ @size = 200
15
+ end
16
+
17
+ def photo
18
+ cache = File.join('/tmp', "polaroid-#{Digest::SHA1.new(@dir + @photo).hexdigest}.png")
19
+ if not File.exists?(cache)
20
+ UWA::Server.log(:info, "Create polaroid photo for #{File.join(@dir, @photo).inspect}")
21
+ image = Magick::Image.read(File.join(@dir, @photo)).first
22
+ if image.rows > @size * 2 or image.columns > @size * 2
23
+ image.resize_to_fit!(@size * 2, @size * 2)
24
+ end
25
+ image = image.polaroid do
26
+ self.shadow_color = "gray80"
27
+ self.pointsize = 12
28
+ end
29
+ image.resize_to_fit!(@size, @size)
30
+ image.write(cache)
31
+ end
32
+ send_file(cache, 'image/png')
33
+ end
34
+ end
35
+ end
36
+ end
Binary file
@@ -0,0 +1,11 @@
1
+
2
+ widget.onLoad = function() {
3
+ var frame = widget.createElement('div');
4
+ frame.className = 'uwa_polaroid';
5
+ widget.setBody(frame);
6
+ var img = widget.createElement('img');
7
+ img.src = widget.remoteUrl + 'photo?size=' + frame.clientWidth;
8
+ frame.appendChild(img);
9
+ }
10
+
11
+
@@ -0,0 +1,4 @@
1
+ .uwa_polaroid {
2
+ padding: 10px;
3
+ text-align: center;
4
+ }
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.2
3
+ specification_version: 1
4
+ name: uwa_polaroid
5
+ version: !ruby/object:Gem::Version
6
+ version: "0.1"
7
+ date: 2007-04-02 00:00:00 +02:00
8
+ summary: UWA Polaroid widget
9
+ require_paths:
10
+ - lib
11
+ email: florent@solt.biz
12
+ homepage: http://gnetvibes.rubyforge.org
13
+ rubyforge_project:
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Florent Solt
31
+ files:
32
+ - lib/uwa_polaroid/config.rb
33
+ - lib/uwa_polaroid/widget.rb
34
+ - ressources/script.js
35
+ - ressources/style.css
36
+ - ressources/photo.png
37
+ test_files: []
38
+
39
+ rdoc_options: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ executables: []
44
+
45
+ extensions: []
46
+
47
+ requirements: []
48
+
49
+ dependencies:
50
+ - !ruby/object:Gem::Dependency
51
+ name: uwa
52
+ version_requirement:
53
+ version_requirements: !ruby/object:Gem::Version::Requirement
54
+ requirements:
55
+ - - ">"
56
+ - !ruby/object:Gem::Version
57
+ version: 0.0.0
58
+ version: