public static boolean isSvgType(final String mimeType) { return AvatarManager.AVATAR_IMAGE_FORMAT_SVG.getContentType().equals(mimeType); }
private boolean hasVectorIcon(final Avatar avatar) { return AvatarManager.AVATAR_IMAGE_FORMAT_SVG.getContentType().equals(avatar.getContentType()); }
public UploadedAvatar scaleImageToTempFile(final Image sourceImage, final File targetFile, final int edgeSize) throws IOException { ThumbnailDimension targetDimension = thumber.determineScaleSize(edgeSize, edgeSize, sourceImage.getWidth(null), sourceImage.getHeight(null)); BufferedImage scaledImage = thumber.scaleImage(sourceImage, targetDimension); ImageIO.write(scaledImage, AVATAR_IMAGE_FORMAT, targetFile); return new UploadedAvatar(targetFile, AVATAR_IMAGE_FORMAT_FULL.getContentType(), targetDimension.getWidth(), targetDimension.getHeight()); } }
@Override public ToBodyPartConsumer prepareBodyPart() throws IOException { final ToBodyPartConsumer dataAccessor = new ToBodyPartConsumer(AvatarManager.AVATAR_IMAGE_FORMAT_FULL.getContentType()); // The size we provide here must match the dimensions of the embedded avatar image in // jira-components/jira-core/src/main/resources/templates/email/html/includes/header.vm , otherwise // Outlook will rewrite the image and destroy our JIRA metadata needed for JRA-25705 final File transcodedAvatar = avatarTranscoder.getOrCreateRasterizedAvatarFile(avatar, size); try (final FileInputStream inputStream = new FileInputStream(transcodedAvatar)) { dataAccessor.consume(inputStream); } return dataAccessor; } }
String temporaryContentType = scaledFileAndContentType.isContentTypeChanged() ? AvatarManager.AVATAR_IMAGE_FORMAT_FULL.getContentType() : contentType; TemporaryAvatar tempAvatar = new TemporaryAvatar(contentType, temporaryContentType, fileName, scaledFile.getResult(), null); ExecutingHttpRequest.get().getSession().setAttribute(SessionKeys.TEMP_AVATAR, tempAvatar);