Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:wordpress-mobile/WordPress-Andro…
Browse files Browse the repository at this point in the history
…id into develop
  • Loading branch information
maxme committed Feb 5, 2015
2 parents d9f758e + fa05a48 commit 3b085ce
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* http://developer.wordpress.com/docs/photon/
*/
public class PhotonUtils {

private PhotonUtils() {
throw new AssertionError();
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3b085ce

Please sign in to comment.