From 8157cf6123cf1c2a02ae13b702d8474ce0bcf362 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Wed, 4 Feb 2015 17:21:02 -0500 Subject: [PATCH] Add strip=all to all Photon requests --- .../wordpress/android/util/PhotonUtils.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/PhotonUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/PhotonUtils.java index 7de378b64e78..fec275791741 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/PhotonUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/PhotonUtils.java @@ -7,6 +7,7 @@ * http://developer.wordpress.com/docs/photon/ */ public class PhotonUtils { + private PhotonUtils() { throw new AssertionError(); } @@ -73,30 +74,29 @@ public static String getPhotonImageUrl(String imageUrl, int width, int height, Q return imageUrl + "?w=" + width + "&h=" + height; } - final String qualityParam; + // strip=all removes EXIF and other non-visual data from JPEGs + String query = "?strip=all"; + switch (quality) { case HIGH: - qualityParam = "quality=100"; + query += "&quality=100"; break; case LOW: - qualityParam = "quality=35"; + query += "&quality=35"; break; default: // medium - qualityParam = "quality=65"; + query += "&quality=65"; break; } // if both width & height are passed use the "resize" param, use only "w" or "h" if just // one of them is set - final String query; if (width > 0 && height > 0) { - query = "?resize=" + width + "," + height + "&" + qualityParam; + query += "&resize=" + width + "," + height; } else if (width > 0) { - query = "?w=" + width + "&" + qualityParam; + query += "&w=" + width; } else if (height > 0) { - query = "?h=" + height + "&" + qualityParam; - } else { - query = "?" + qualityParam; + query += "&h=" + height; } // return passed url+query if it's already a photon url