Solved

applet to resize images on client machine then upload to the server

Posted on 2006-11-12
4
732 Views
Last Modified: 2008-01-09
Hi Experts,

Upload files to server and then resize it, it's easy to achieve. I've done it already by .net.  My boss wants to resize it on client side, and do the multi upload as well, then upload to the server. My boss said  he wanted to save not only bandwith but also improve upload speed for end users He wants to use java applet/flash on the client side, because it's cross browser support. He believes it's achievable, and that's why I'm asking this question. Some experts said it's not achieable by flash. But I found a software written by java applet, which can resize image at client side then upload to the server. Here is the demo website: http://upload.thinfile.com/image/demo.php

Has anyone got any ideas about it?

Regards,
Lijunguo
0
Comment
Question by:lijunguo
  • 3
4 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 17926442
It's not the applet, it's the code that you use to resize, and that's applicable in any program.

   /**
    * Resizes an Image by stretching it to a new size by x factor and y factor.
    *
    * @param picture the initial image.
    * @param xFactor the width stretching factor.
    * @param yFactor the height stretching factor.
    * @return the stretched image.
    */
   public static Image resize(Image picture, double xFactor, double yFactor)
   {
      BufferedImage buffer;
      Graphics2D g;
      AffineTransform transformer;
      AffineTransformOp operation;

      buffer = new BufferedImage
      (
         picture.getWidth(null),
         picture.getHeight(null),
         BufferedImage.TYPE_INT_ARGB
      );
      g = buffer.createGraphics();
      g.drawImage(picture, 0, 0, null);
      transformer = new AffineTransform();
      transformer.scale(xFactor, yFactor);
      operation = new AffineTransformOp(transformer, AffineTransformOp.TYPE_BILINEAR);
      buffer = operation.filter(buffer, null);
      return(Toolkit.getDefaultToolkit().createImage(buffer.getSource()));
   }

;JOOP!
0
 
LVL 11

Author Comment

by:lijunguo
ID: 17927946
where do you put that code in? You put it in a jsp page or a serverlet page? Or an applet page. If it's not in a applet page, you are processing the image from the server side, not the client side. I've already done everything from server side with .net, such as resizing, get thumbnails, what I need is to do it on end user's machine. In their machine's memory, resize it, then upload it to the server. Not resize from the server.

Regards,
Lijunguo
0
 
LVL 24

Accepted Solution

by:
sciuriware earned 500 total points
ID: 17928397
In your case you put that code into an Applet, in the method that responds
on a mouse click or other command that requests the resizing.
It is also possible that the code is added to the code that accepts an image
and prepares it for transmission.

;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17993643
:)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question