Skip to content

Commit fa05a48

Browse files
committed
Add strip=all to all Photon requests
1 parent 21a72fe commit fa05a48

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/PhotonUtils.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* http://developer.wordpress.com/docs/photon/
88
*/
99
public class PhotonUtils {
10+
1011
private PhotonUtils() {
1112
throw new AssertionError();
1213
}
@@ -73,30 +74,29 @@ public static String getPhotonImageUrl(String imageUrl, int width, int height, Q
7374
return imageUrl + "?w=" + width + "&h=" + height;
7475
}
7576

76-
final String qualityParam;
77+
// strip=all removes EXIF and other non-visual data from JPEGs
78+
String query = "?strip=all";
79+
7780
switch (quality) {
7881
case HIGH:
79-
qualityParam = "quality=100";
82+
query += "&quality=100";
8083
break;
8184
case LOW:
82-
qualityParam = "quality=35";
85+
query += "&quality=35";
8386
break;
8487
default: // medium
85-
qualityParam = "quality=65";
88+
query += "&quality=65";
8689
break;
8790
}
8891

8992
// if both width & height are passed use the "resize" param, use only "w" or "h" if just
9093
// one of them is set
91-
final String query;
9294
if (width > 0 && height > 0) {
93-
query = "?resize=" + width + "," + height + "&" + qualityParam;
95+
query += "&resize=" + width + "," + height;
9496
} else if (width > 0) {
95-
query = "?w=" + width + "&" + qualityParam;
97+
query += "&w=" + width;
9698
} else if (height > 0) {
97-
query = "?h=" + height + "&" + qualityParam;
98-
} else {
99-
query = "?" + qualityParam;
99+
query += "&h=" + height;
100100
}
101101

102102
// return passed url+query if it's already a photon url

0 commit comments

Comments
 (0)