Adjust to final animated GIF interface

This commit is contained in:
Tom Hughes 2019-05-13 20:17:01 +01:00
parent b88b699f49
commit a6ea75a2e2
3 changed files with 12 additions and 19 deletions

View file

@ -117,7 +117,7 @@ gem "canonical-rails"
gem "logstasher" gem "logstasher"
# Used to generate images for traces # Used to generate images for traces
gem "gd2-ffij", :git => "https://github.com/mmd-osm/gd2-ffij.git", :branch => "animated_gif" gem "gd2-ffij", "= 0.4.0.dev"
# Used for browser detection # Used for browser detection
gem "browser" gem "browser"

View file

@ -1,11 +1,3 @@
GIT
remote: https://github.com/mmd-osm/gd2-ffij.git
revision: c92057a8f699a36b5f6d208db3d11eb3bae185dd
branch: animated_gif
specs:
gd2-ffij (0.3.1)
ffi (>= 1.0.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
@ -181,6 +173,8 @@ GEM
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.10.0) ffi (1.10.0)
fspath (3.1.0) fspath (3.1.0)
gd2-ffij (0.4.0.dev)
ffi (>= 1.0.0)
geoip (1.6.4) geoip (1.6.4)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@ -468,7 +462,7 @@ DEPENDENCIES
factory_bot_rails factory_bot_rails
fakefs fakefs
faraday faraday
gd2-ffij! gd2-ffij (= 0.4.0.dev)
geoip geoip
htmlentities htmlentities
http_accept_language (~> 2.0.0) http_accept_language (~> 2.0.0)
@ -518,4 +512,4 @@ DEPENDENCIES
webmock webmock
BUNDLED WITH BUNDLED WITH
1.16.6 1.17.2

View file

@ -100,16 +100,15 @@ module GPX
end end
end end
res = GD2::AnimatedGif.gif_anim_begin(frames[0]) image = GD2::AnimatedGif.new
res << GD2::AnimatedGif.gif_anim_add(frames[0], nil, delay) frames.each do |frame|
(1...nframes).each do |n| image.add(frame, :delay => delay)
res << GD2::AnimatedGif.gif_anim_add(frames[n],
(frames[n] == frames[n - 1] ? nil : frames[n - 1]),
delay)
end end
res << GD2::AnimatedGif.gif_anim_end image.end
res output = StringIO.new
image.export(output)
output.read
end end
def icon(min_lat, min_lon, max_lat, max_lon) def icon(min_lat, min_lon, max_lat, max_lon)