From 2f23ee18309f139230983109059529fd3fea6801 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9gis=20Hanol?= <regis@hanol.fr>
Date: Wed, 11 Jun 2014 16:01:01 +0200
Subject: [PATCH] BUGFIX: keep transparent background in avatars

---
 app/models/optimized_image.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/models/optimized_image.rb b/app/models/optimized_image.rb
index 1461dfad4a9..c34d9632a62 100644
--- a/app/models/optimized_image.rb
+++ b/app/models/optimized_image.rb
@@ -68,12 +68,13 @@ class OptimizedImage < ActiveRecord::Base
   end
 
   def self.resize(from, to, width, height)
+    # NOTE: ORDER is important!
     instructions = %W{
       #{from}
+      -background transparent
       -gravity center
       -thumbnail #{width}x#{height}^
       -extent #{width}x#{height}
-      -background transparent
       -interpolate bicubic
       -unsharp 2x0.5+0.7+0
       -quality 98