if ("gif".equalsIgnoreCase(extension) || "svg".equalsIgnoreCase(extension)) {
LOGGER.debug("GIF or SVG asset detected; will render the original rendition.");
stream(response, asset.getOriginal().getStream(), imageType, imageName);
return;
double renditionWidth;
if (webRendition != null) {
try (InputStream renditionStream = webRendition.getStream()) {
Layer rendition = new Layer(renditionStream);
renditionWidth = rendition.getWidth();
LOGGER.debug("Found rendition {} with a width equal to the resize width ({}px); rendering.", rendition.getPath(),
resizeWidth);
stream(response, rendition.getStream(), imageType, imageName);
} else {
int resizeHeight = calculateResizeHeight(originalWidth, originalHeight, resizeWidth);
LOGGER.debug("Rendering the original asset {} since its width ({}px) is either smaller than the requested " +
"width ({}px) or since no resize is needed.", asset.getPath(), originalWidth, resizeWidth);
stream(response, asset.getOriginal().getStream(), imageType, imageName);
stream(response, asset.getOriginal().getStream(), imageType, imageName);