@Test public void basic(){ final String result = QImage.createMogr(HOST).toUrl(); assertEquals(HOST + "?imageMogr2", result); }
public String toUrl(){ StringBuilder builder = new StringBuilder(host); builder.append("?") .append(TAG); if (autoOrient){ append(builder); builder.append("auto-orient"); } if (thumbnail != null){ append(builder); builder.append("thumbnail"); append(builder); builder.append(thumbnail); } if (strip){ append(builder); builder.append("strip"); } if (gravity != null){ append(builder); builder.append("gravity"); append(builder); builder.append(gravity); } if (scrop){ } if (width != QImage.ORIGINAL_SIZE || height != QImage.ORIGINAL_SIZE){ if (scrop){ append(builder); builder.append("scrop"); }else { append(builder); builder.append("crop"); } if (dx != QImage.ORIGINAL_SIZE || dy != QImage.ORIGINAL_SIZE){ append(builder); builder.append("!"); }else { append(builder); } if (width != QImage.ORIGINAL_SIZE && height != QImage.ORIGINAL_SIZE){ builder.append(width) .append("x") .append(height); }else if(width != QImage.ORIGINAL_SIZE ){ builder.append(width) .append("x"); }else { builder.append("x") .append(height); } if (dx != QImage.ORIGINAL_SIZE){ if (dx < 0){ builder.append(dx); }else { builder.append("a"); builder.append(dx); } } if (dx != QImage.ORIGINAL_SIZE){ if (dy < 0){ builder.append(dy); }else { builder.append("a"); builder.append(dy); } } } if (rotate != QImage.ORIGINAL_SIZE){ append(builder); builder.append("rotate"); append(builder); builder.append(rotate); } if (format != null){ append(builder) .append("format"); append(builder) .append(format); } if (amount != QImage.ORIGINAL_QUALITY){ append(builder) .append("quality"); if (hasOver){ builder.append("!"); } append(builder) .append(amount); } if (frameNumber != QImage.ORIGINAL_QUALITY){ append(builder) .append("cgif"); append(builder) .append(frameNumber); } if (interlace){ append(builder) .append("interlace"); append(builder) .append("1"); } return builder.toString(); }
QImageMogr2UrlBuilder { public String toUrl(){ StringBuilder builder = new StringBuilder(host); builder.append("?") .append(TAG); if (autoOrient){ append(builder); builder.append("auto-orient"); } if (thumbnail != null){ append(builder); builder.append("thumbnail"); append(builder); builder.append(thumbnail); } if (strip){ append(builder); builder.append("strip"); } if (gravity != null){ append(builder); builder.append("gravity"); append(builder); builder.append(gravity); } if (scrop){ } if (width != QImage.ORIGINAL_SIZE || height != QImage.ORIGINAL_SIZE){ if (scrop){ append(builder); builder.append("scrop"); }else { append(builder); builder.append("crop"); } if (dx != QImage.ORIGINAL_SIZE || dy != QImage.ORIGINAL_SIZE){ append(builder); builder.append("!"); }else { append(builder); } if (width != QImage.ORIGINAL_SIZE && height != QImage.ORIGINAL_SIZE){ builder.append(width) .append("x") .append(height); }else if(width != QImage.ORIGINAL_SIZE ){ builder.append(width) .append("x"); }else { builder.append("x") .append(height); } if (dx != QImage.ORIGINAL_SIZE){ if (dx < 0){ builder.append(dx); }else { builder.append("a"); builder.append(dx); } } if (dx != QImage.ORIGINAL_SIZE){ if (dy < 0){ builder.append(dy); }else { builder.append("a"); builder.append(dy); } } } if (rotate != QImage.ORIGINAL_SIZE){ append(builder); builder.append("rotate"); append(builder); builder.append(rotate); } if (format != null){ append(builder) .append("format"); append(builder) .append(format); } if (amount != QImage.ORIGINAL_QUALITY){ append(builder) .append("quality"); if (hasOver){ builder.append("!"); } append(builder) .append(amount); } if (frameNumber != QImage.ORIGINAL_QUALITY){ append(builder) .append("cgif"); append(builder) .append(frameNumber); } if (interlace){ append(builder) .append("interlace"); append(builder) .append("1"); } return builder.toString(); } }
QImageMogr2UrlBuilder { public String toUrl(){ StringBuilder builder = new StringBuilder(host); builder.append("?") .append(TAG); if (autoOrient){ append(builder); builder.append("auto-orient"); } if (thumbnail != null){ append(builder); builder.append("thumbnail"); append(builder); builder.append(thumbnail); } if (strip){ append(builder); builder.append("strip"); } if (gravity != null){ append(builder); builder.append("gravity"); append(builder); builder.append(gravity); } if (scrop){ } if (width != QImage.ORIGINAL_SIZE || height != QImage.ORIGINAL_SIZE){ if (scrop){ append(builder); builder.append("scrop"); }else { append(builder); builder.append("crop"); } if (dx != QImage.ORIGINAL_SIZE || dy != QImage.ORIGINAL_SIZE){ append(builder); builder.append("!"); }else { append(builder); } if (width != QImage.ORIGINAL_SIZE && height != QImage.ORIGINAL_SIZE){ builder.append(width) .append("x") .append(height); }else if(width != QImage.ORIGINAL_SIZE ){ builder.append(width) .append("x"); }else { builder.append("x") .append(height); } if (dx != QImage.ORIGINAL_SIZE){ if (dx < 0){ builder.append(dx); }else { builder.append("a"); builder.append(dx); } } if (dx != QImage.ORIGINAL_SIZE){ if (dy < 0){ builder.append(dy); }else { builder.append("a"); builder.append(dy); } } } if (rotate != QImage.ORIGINAL_SIZE){ append(builder); builder.append("rotate"); append(builder); builder.append(rotate); } if (format != null){ append(builder) .append("format"); append(builder) .append(format); } if (amount != QImage.ORIGINAL_QUALITY){ append(builder) .append("quality"); if (hasOver){ builder.append("!"); } append(builder) .append(amount); } if (frameNumber != QImage.ORIGINAL_QUALITY){ append(builder) .append("cgif"); append(builder) .append(frameNumber); } if (interlace){ append(builder) .append("interlace"); append(builder) .append("1"); } return builder.toString(); } QImageMogr2UrlBuilder(String host); }
QImageMogr2UrlBuilder { public String toUrl(){ StringBuilder builder = new StringBuilder(host); builder.append("?") .append(TAG); if (autoOrient){ append(builder); builder.append("auto-orient"); } if (thumbnail != null){ append(builder); builder.append("thumbnail"); append(builder); builder.append(thumbnail); } if (strip){ append(builder); builder.append("strip"); } if (gravity != null){ append(builder); builder.append("gravity"); append(builder); builder.append(gravity); } if (scrop){ } if (width != QImage.ORIGINAL_SIZE || height != QImage.ORIGINAL_SIZE){ if (scrop){ append(builder); builder.append("scrop"); }else { append(builder); builder.append("crop"); } if (dx != QImage.ORIGINAL_SIZE || dy != QImage.ORIGINAL_SIZE){ append(builder); builder.append("!"); }else { append(builder); } if (width != QImage.ORIGINAL_SIZE && height != QImage.ORIGINAL_SIZE){ builder.append(width) .append("x") .append(height); }else if(width != QImage.ORIGINAL_SIZE ){ builder.append(width) .append("x"); }else { builder.append("x") .append(height); } if (dx != QImage.ORIGINAL_SIZE){ if (dx < 0){ builder.append(dx); }else { builder.append("a"); builder.append(dx); } } if (dx != QImage.ORIGINAL_SIZE){ if (dy < 0){ builder.append(dy); }else { builder.append("a"); builder.append(dy); } } } if (rotate != QImage.ORIGINAL_SIZE){ append(builder); builder.append("rotate"); append(builder); builder.append(rotate); } if (format != null){ append(builder) .append("format"); append(builder) .append(format); } if (amount != QImage.ORIGINAL_QUALITY){ append(builder) .append("quality"); if (hasOver){ builder.append("!"); } append(builder) .append(amount); } if (frameNumber != QImage.ORIGINAL_QUALITY){ append(builder) .append("cgif"); append(builder) .append(frameNumber); } if (interlace){ append(builder) .append("interlace"); append(builder) .append("1"); } return builder.toString(); } QImageMogr2UrlBuilder(String host); String getHost(); QImageMogr2UrlBuilder autoOrient(); QImageMogr2UrlBuilder strip(); QImageMogr2UrlBuilder scrop(); QImageMogr2UrlBuilder interlace(); QImageMogr2UrlBuilder gravity(QImage.GravityType gravityType); QImageMogr2UrlBuilder format(QImage.ImageFormat format); QImageMogr2UrlBuilder quality(int amount, boolean over); QImageMogr2UrlBuilder quality(int amount); QImageMogr2UrlBuilder rotate(int rotate); QImageMogr2UrlBuilder frameNumber(int frameNumber); QImageMogr2UrlBuilder cropWidth(int width); QImageMogr2UrlBuilder cropHeight(int height); QImageMogr2UrlBuilder crop(int width, int height); QImageMogr2UrlBuilder offsetX(int dx); QImageMogr2UrlBuilder offsetY(int dy); QImageMogr2UrlBuilder offset(int dx, int dy); QImageMogr2UrlBuilder thumbnail(int width, int height); QImageMogr2UrlBuilder thumbnailScaleeWidth(int width); QImageMogr2UrlBuilder thumbnailScaleeHeight(int height); QImageMogr2UrlBuilder thumbnailWidthe(int width); QImageMogr2UrlBuilder thumbnailHeighte(int height); QImageMogr2UrlBuilder thumbnailEdgeeMax(int width, int height); QImageMogr2UrlBuilder thumbnailEdgeeMin(int width, int height); String toUrl(); }
QImageMogr2UrlBuilder { public String toUrl(){ StringBuilder builder = new StringBuilder(host); builder.append("?") .append(TAG); if (autoOrient){ append(builder); builder.append("auto-orient"); } if (thumbnail != null){ append(builder); builder.append("thumbnail"); append(builder); builder.append(thumbnail); } if (strip){ append(builder); builder.append("strip"); } if (gravity != null){ append(builder); builder.append("gravity"); append(builder); builder.append(gravity); } if (scrop){ } if (width != QImage.ORIGINAL_SIZE || height != QImage.ORIGINAL_SIZE){ if (scrop){ append(builder); builder.append("scrop"); }else { append(builder); builder.append("crop"); } if (dx != QImage.ORIGINAL_SIZE || dy != QImage.ORIGINAL_SIZE){ append(builder); builder.append("!"); }else { append(builder); } if (width != QImage.ORIGINAL_SIZE && height != QImage.ORIGINAL_SIZE){ builder.append(width) .append("x") .append(height); }else if(width != QImage.ORIGINAL_SIZE ){ builder.append(width) .append("x"); }else { builder.append("x") .append(height); } if (dx != QImage.ORIGINAL_SIZE){ if (dx < 0){ builder.append(dx); }else { builder.append("a"); builder.append(dx); } } if (dx != QImage.ORIGINAL_SIZE){ if (dy < 0){ builder.append(dy); }else { builder.append("a"); builder.append(dy); } } } if (rotate != QImage.ORIGINAL_SIZE){ append(builder); builder.append("rotate"); append(builder); builder.append(rotate); } if (format != null){ append(builder) .append("format"); append(builder) .append(format); } if (amount != QImage.ORIGINAL_QUALITY){ append(builder) .append("quality"); if (hasOver){ builder.append("!"); } append(builder) .append(amount); } if (frameNumber != QImage.ORIGINAL_QUALITY){ append(builder) .append("cgif"); append(builder) .append(frameNumber); } if (interlace){ append(builder) .append("interlace"); append(builder) .append("1"); } return builder.toString(); } QImageMogr2UrlBuilder(String host); String getHost(); QImageMogr2UrlBuilder autoOrient(); QImageMogr2UrlBuilder strip(); QImageMogr2UrlBuilder scrop(); QImageMogr2UrlBuilder interlace(); QImageMogr2UrlBuilder gravity(QImage.GravityType gravityType); QImageMogr2UrlBuilder format(QImage.ImageFormat format); QImageMogr2UrlBuilder quality(int amount, boolean over); QImageMogr2UrlBuilder quality(int amount); QImageMogr2UrlBuilder rotate(int rotate); QImageMogr2UrlBuilder frameNumber(int frameNumber); QImageMogr2UrlBuilder cropWidth(int width); QImageMogr2UrlBuilder cropHeight(int height); QImageMogr2UrlBuilder crop(int width, int height); QImageMogr2UrlBuilder offsetX(int dx); QImageMogr2UrlBuilder offsetY(int dy); QImageMogr2UrlBuilder offset(int dx, int dy); QImageMogr2UrlBuilder thumbnail(int width, int height); QImageMogr2UrlBuilder thumbnailScaleeWidth(int width); QImageMogr2UrlBuilder thumbnailScaleeHeight(int height); QImageMogr2UrlBuilder thumbnailWidthe(int width); QImageMogr2UrlBuilder thumbnailHeighte(int height); QImageMogr2UrlBuilder thumbnailEdgeeMax(int width, int height); QImageMogr2UrlBuilder thumbnailEdgeeMin(int width, int height); String toUrl();  }