Package er.attachment.utils

Examples of er.attachment.utils.ERMimeType


   * @param inputFile the input file to thumbnail
   * @param outputFile the output file to write the thumbnail into
   * @throws IOException if the thumbnailing fails
   */
  public void thumbnail(int resizeWidth, int resizeHeight, File inputFile, File outputFile) throws IOException {
    ERMimeType outputMimeType = ERMimeTypeManager.mimeTypeManager().mimeTypeForFile(outputFile, true);
    thumbnail(resizeWidth, resizeHeight, inputFile, outputFile, outputMimeType);
  }
View Full Code Here


  private String mimeType(String recommendedFileName) {
    String suggestedMimeType = null;
    String extension = ERXFileUtilities.fileExtension(recommendedFileName);

    ERMimeType erMimeType = ERMimeTypeManager.mimeTypeManager().mimeTypeForExtension(extension, false);
    if (erMimeType != null) {
      suggestedMimeType = erMimeType.mimeType();
    }

    if (suggestedMimeType == null) {
      suggestedMimeType = "application/x-octet-stream";
    }
View Full Code Here

      throw maxSizeExceededException;
    }
   
    String suggestedMimeType = pendingAttachment.mimeType();
    if (suggestedMimeType != null) {
      ERMimeType erMimeType = ERMimeTypeManager.mimeTypeManager().mimeTypeForMimeTypeString(suggestedMimeType, false);
      if (erMimeType == null) {
        suggestedMimeType = null;
      }
    }
   
    if (suggestedMimeType == null) {
      String extension = ERXFileUtilities.fileExtension(recommendedFileName);
      ERMimeType erMimeType = ERMimeTypeManager.mimeTypeManager().mimeTypeForExtension(extension, false);
      if (erMimeType != null) {
        suggestedMimeType = erMimeType.mimeType();
      }

      if (suggestedMimeType == null) {
        suggestedMimeType = "application/x-octet-stream";
      }
    }

    int width = pendingAttachment.width();
    int height = pendingAttachment.height();
    if (width != -1 || height != -1) {
      ERMimeType mimeType = ERMimeTypeManager.mimeTypeManager().mimeTypeForMimeTypeString(suggestedMimeType, false);
      if (mimeType != null) {
        IERThumbnailer thumbnailer = ERThumbnailer.thumbnailer(mimeType);
        if (thumbnailer != null) {
          thumbnailer.thumbnail(width, height, uploadedFile, uploadedFile, mimeType);
        }
View Full Code Here

    String viewerClassName = null;

    ERAttachment attachment = attachment();
    if (attachment != null) {
      if (attachment.available().booleanValue()) {
        ERMimeType mimeType = attachment.erMimeType();
        if (mimeType != null) {
          viewerClassName = ERXProperties.stringForKey("er.attachment.mimeType." +  mimeType.mimeType() +".viewer");
          if (viewerClassName == null) {
            viewerClassName = ERXProperties.stringForKey("er.attachment.mimeType." +  mimeType.globMimeType().mimeType() +".viewer");
          }
        }
      }
      else {
        viewerClassName = ERXProperties.stringForKey("er.attachment.mimeType.unavailable.viewer");
View Full Code Here

  public static String iconPath(ERAttachment attachment, Object size) {
    String sizeStr = "16";
    if (size != null) {
      sizeStr = size.toString();
    }
    ERMimeType erMimeType = null;
    if (attachment != null) {
      erMimeType = attachment.erMimeType();
    }
    String mimeType;
    if (erMimeType == null) {
      mimeType = "application/x-octet-stream";
    }
    else {
      mimeType = erMimeType.mimeType();
    }
    String iconPath = "icons/" + sizeStr + "/" + mimeType + ".png";
    return iconPath;
  }
View Full Code Here

   * @return アタッチメントの拡張子
   * </span>
   */
  public String extension() {
    String ext;
    ERMimeType mimeType = erMimeType();
    if (mimeType == null) {
      ext = ERXFileUtilities.fileExtension(originalFileName()).toLowerCase();
    }
    else {
      ext = mimeType.primaryExtension();
    }
    return ext;
  }
View Full Code Here

    File watermarkFile = new File("Tests/w.jpg");
    //File watermarkFile = null;
    boolean tileWatermark = false;
    File colorProfileFile = new File("Resources/sRGB.icc");
    //processor.processImage(150, 150, null, -1, 2.5f, 0.35f, 0.0f, -1, -1, -1, -1, watermarkFile, tileWatermark, 0.9f, colorProfileFile, inputFile, outputFile, new ERMimeType("jpeg", "image/jpg", "public.jpeg", new NSArray<String>(new String[] { "jpg" })));
    processor.processImage(150, 150, null, -1, 0.0f, 0.0f, 0.0f, -1, -1, -1, -1, null, false, 0.9f, colorProfileFile, inputFile, outputFile, new ERMimeType("jpeg", "image/jpg", "public.jpeg", new NSArray<String>(new String[] { "jpg" })));
    //Runtime.getRuntime().exec(new String[] { "open", outputFile.getAbsolutePath() });
  }
View Full Code Here

TOP

Related Classes of er.attachment.utils.ERMimeType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.