Solved

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

Posted on 2006-11-12
4
726 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
:)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java 1603 Error 2 42
array11 challenge 16 51
eclipse package explorer vs project explorer view 2 27
Java Jpanels and Jframe 8 20
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now