Examples of ImageParam


Examples of ru.org.linux.util.image.ImageParam

  public ImageParam checkUserPic(File file) throws UserErrorException, IOException, BadImageException {
    if (!file.isFile()) {
      throw new UserErrorException("Сбой загрузки изображения: не файл");
    }

    ImageParam param = ImageUtil.imageCheck(file);

    if(param.isAnimated()) {
      throw new UserErrorException("Сбой загрузки изображения: анимация не допустима");
    }

    if(param.getSize() > MAX_USERPIC_FILESIZE) {
      throw new UserErrorException("Сбой загрузки изображения: слишком большой файл");
    }


    if (param.getHeight()<MIN_IMAGESIZE || param.getHeight() > MAX_IMAGESIZE) {
      throw new UserErrorException("Сбой загрузки изображения: недопустимые размеры фотографии");
    }

    if (param.getWidth()<MIN_IMAGESIZE || param.getWidth() > MAX_IMAGESIZE) {
      throw new UserErrorException("Сбой загрузки изображения: недопустимые размеры фотографии");
    }

    return param;
  }
View Full Code Here

Examples of ru.org.linux.util.image.ImageParam

    if (file.length() > MAX_SCREENSHOT_FILESIZE) {
      errors.reject(null, "Сбой загрузки изображения: слишком большой файл");
      error = true;
    }

    ImageParam imageParam = ImageUtil.imageCheck(file);

    if (imageParam.getHeight()< MIN_SCREENSHOT_SIZE || imageParam.getHeight() > MAX_SCREENSHOT_SIZE) {
      errors.reject(null, "Сбой загрузки изображения: недопустимые размеры изображения");
      error = true;
    }

    if (imageParam.getWidth()<MIN_SCREENSHOT_SIZE || imageParam.getWidth() > MAX_SCREENSHOT_SIZE) {
      errors.reject(null, "Сбой загрузки изображения: недопустимые размеры изображения");
      error = true;
    }

    if (!error) {
      File tempFile = File.createTempFile("preview-", "", new File(dir));

      try {
        String name = tempFile.getName();

        Screenshot scrn = new Screenshot(name, dir, imageParam.getExtension());

        scrn.doResize(file);

        return scrn;
      } finally {
View Full Code Here

Examples of ru.org.linux.util.image.ImageParam

    try {
      File uploadedFile = File.createTempFile("userpic", "", new File(siteConfig.getPathPrefix() + "/linux-storage/tmp/"));

      file.transferTo(uploadedFile);

      ImageParam param = userService.checkUserPic(uploadedFile);
      String extension = param.getExtension();

      Random random = new Random();

      String photoname;
      File photofile;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.