Package edu.drexel.goodwin.cpd.domain

Examples of edu.drexel.goodwin.cpd.domain.ProfilePicture


        uploadedRescaledImage = GraphicsUtilities.createThumbnail(uploadedRescaledImage, maxSize);
      }
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ImageIO.write(uploadedRescaledImage, "png", baos);

      ProfilePicture profilePicture = new ProfilePicture();
      profilePicture.setMimeType(uploadedPicture.getContentType());
      profilePicture.setBytes(baos.toByteArray());
      profilePicture.setWidth(uploadedRescaledImage.getWidth());
      profilePicture.setHeight(uploadedRescaledImage.getHeight());
      researcher.setProfilePicture(profilePicture);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here


  public void handleProfilePictureRequest(@PathVariable("id") Long id, HttpServletRequest req, HttpServletResponse resp) {
    if (id == null) {
      throw new IllegalArgumentException("An Identifier is required");
    }
   
    ProfilePicture researcherProfilePicture = researcherManager.getProfilePictureForThisResearcher(id);

    if (researcherProfilePicture == null) {
      resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    resp.setContentType(researcherProfilePicture.getMimeType());

    InputStream in = null;
    OutputStream out = null;
    try {
      resp.setContentLength((int) researcherProfilePicture.getBytes().length);
      in = new ByteArrayInputStream(researcherProfilePicture.getBytes());
      out = resp.getOutputStream();

      byte[] buf = new byte[BYTE_BUFFER_SIZE];
      int count = 0;
      while ((count = in.read(buf)) >= 0) {
View Full Code Here

TOP

Related Classes of edu.drexel.goodwin.cpd.domain.ProfilePicture

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.