Gilles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/256686
Change subject: Thumbor GIF support
......................................................................
Thumbor GIF support
Bug: T120200
Change-Id: Ic5c95b7ba3923edbdf27c849234188137d6a2fd1
---
M puppet/modules/thumbor/manifests/init.pp
M puppet/modules/thumbor/templates/thumbor.conf.erb
M puppet/modules/thumbor/templates/varnish.vcl.erb
3 files changed, 18 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant
refs/changes/86/256686/1
diff --git a/puppet/modules/thumbor/manifests/init.pp
b/puppet/modules/thumbor/manifests/init.pp
index 4f11284..b567146 100644
--- a/puppet/modules/thumbor/manifests/init.pp
+++ b/puppet/modules/thumbor/manifests/init.pp
@@ -40,6 +40,8 @@
# not used here by default because of
https://github.com/thumbor/opencv-engine/issues/16
require_package('python-opencv')
+ require_package('gifsicle')
+
$statsd_host = 'localhost'
$statsd_prefix = 'Thumbor'
@@ -102,13 +104,13 @@
varnish::backend { 'thumbor':
host => '127.0.0.1',
port => '8888',
- onlyif => 'req.url ~ "^/images/thumb/.*\.(jpeg|jpg|png)"',
+ onlyif => 'req.url ~ "^/images/thumb/.*\.(jpeg|jpg|jpe|png|apng|gif)"',
}
varnish::backend { 'swift':
host => '127.0.0.1',
port => $::swift::port,
- onlyif => 'req.url ~ "^/images/(?!thumb/).*\.(jpeg|jpg|png)"',
+ onlyif => 'req.url ~ "^/images/(?!thumb/).*"',
}
varnish::config { 'thumbor':
diff --git a/puppet/modules/thumbor/templates/thumbor.conf.erb
b/puppet/modules/thumbor/templates/thumbor.conf.erb
index cb6800b..7508272 100644
--- a/puppet/modules/thumbor/templates/thumbor.conf.erb
+++ b/puppet/modules/thumbor/templates/thumbor.conf.erb
@@ -112,7 +112,7 @@
## cropping and filters are not supported for gifs using gifsicle (but won't
## give an error).
## Defaults to: False
-#USE_GIFSICLE_ENGINE = False
+USE_GIFSICLE_ENGINE = True
## Indicates whether thumbor should enable blacklist functionality to prevent
## processing certain images.
diff --git a/puppet/modules/thumbor/templates/varnish.vcl.erb
b/puppet/modules/thumbor/templates/varnish.vcl.erb
index d54b94b..f5bef39 100644
--- a/puppet/modules/thumbor/templates/varnish.vcl.erb
+++ b/puppet/modules/thumbor/templates/varnish.vcl.erb
@@ -57,18 +57,22 @@
ban("req.url == " + req.url);
}
- # qlow jpg thumbs
- if (req.url ~ "^/images/thumb/(.*)/qlow-(\d+)px-.*\.(jpg|jpeg)") {
- set req.url = "/unsafe/" + regsub(req.url,
"^/images/thumb/(.*)/qlow-(\d+)px-.*\.(jpg|jpeg)", "\2") +
"x/filters:quality(40):sharpen(0.6,0.01,false)/127.0.0.1:<%=
scope['::swift::port'] %>/v1/AUTH_testproj/wiki-local-public/" +
regsub(req.url, "^/images/thumb/(.*)/qlow-(\d+)px-.*\.(jpg|jpeg)", "\1");
+ # qlow jpg thumbs (thumbor)
+ if (req.url ~ "^/images/thumb/(.*)/qlow-(\d+)px-.*\.(jpg|jpeg|jpe)") {
+ set req.url = "/unsafe/" + regsub(req.url,
"^/images/thumb/(.*)/qlow-(\d+)px-.*\.(jpg|jpeg|jpe)", "\2") +
"x/filters:quality(40):sharpen(0.6,0.01,false)/127.0.0.1:<%=
scope['::swift::port'] %>/v1/AUTH_testproj/wiki-local-public/" +
regsub(req.url, "^/images/thumb/(.*)/qlow-(\d+)px-.*\.(jpg|jpeg|jpe)", "\1");
return (hash);
- # regular jpg thumbs
- } else if (req.url ~ "^/images/thumb/(.*)/(\d+)px-.*\.(jpg|jpeg)") {
- set req.url = "/unsafe/" + regsub(req.url,
"^/images/thumb/(.*)/(\d+)px-.*\.(jpg|jpeg)", "\2") +
"x/filters:quality(87):sharpen(0.6,0.01,false)/127.0.0.1:<%=
scope['::swift::port'] %>/v1/AUTH_testproj/wiki-local-public/" +
regsub(req.url, "^/images/thumb/(.*)/(\d+)px-.*\.(jpg|jpeg)", "\1");
+ # regular jpg thumbs (thumbor)
+ } else if (req.url ~ "^/images/thumb/(.*)/(\d+)px-.*\.(jpg|jpeg|jpe)") {
+ set req.url = "/unsafe/" + regsub(req.url,
"^/images/thumb/(.*)/(\d+)px-.*\.(jpg|jpeg|jpe)", "\2") +
"x/filters:quality(87):sharpen(0.6,0.01,false)/127.0.0.1:<%=
scope['::swift::port'] %>/v1/AUTH_testproj/wiki-local-public/" +
regsub(req.url, "^/images/thumb/(.*)/(\d+)px-.*\.(jpg|jpeg|jpe)", "\1");
return (hash);
- # png thumbs
- } else if (req.url ~ "^/images/thumb/(.*)/(\d+)px-.*\.png") {
- set req.url = "/unsafe/" + regsub(req.url,
"^/images/thumb/(.*)/(\d+)px-.*\.png", "\2") + "x/127.0.0.1:<%=
scope['::swift::port'] %>/v1/AUTH_testproj/wiki-local-public/" +
regsub(req.url, "^/images/thumb/(.*)/(\d+)px-.*\.png", "\1");
+ # png & gif thumbs, no filters (thumbor)
+ } else if (req.url ~ "^/images/thumb/(.*)/(\d+)px-.*\.(png|apng|gif)") {
+ set req.url = "/unsafe/" + regsub(req.url,
"^/images/thumb/(.*)/(\d+)px-.*\.(png|apng|gif)", "\2") + "x/127.0.0.1:<%=
scope['::swift::port'] %>/v1/AUTH_testproj/wiki-local-public/" +
regsub(req.url, "^/images/thumb/(.*)/(\d+)px-.*\.(png|apng|gif)", "\1");
return (hash);
+ # thumbs unsupported by thumbor (mediawiki)
+ } else if (req.url ~ "^/images/thumb/.*") {
+ return (hash);
+ # originals (swift)
} else if (req.url ~ "^/images/(.*)") {
set req.url = "/v1/AUTH_testproj/wiki-local-public/" + regsub(req.url,
"^/images/(.*)", "\1");
return (hash);
--
To view, visit https://gerrit.wikimedia.org/r/256686
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5c95b7ba3923edbdf27c849234188137d6a2fd1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Gilles <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits