views:

373

answers:

5

I am working on a web application that will deal with many image uploads. Its quite likely that the users will be in areas with slow internet connections and I'm hoping to save them upload time by compressing the images before uploading.

I have seen that Aurigma Image Uploader achieves this using a java applet or active x but it's expensive and I'd rather something open source or at least a little cheaper. Ideally I'd like to roll my own if its at all possible.

I'm developing on Ruby on Rails if that makes any difference..

Thanks!

Edit just to clarify: I don't mind if the solution uses activeX or an applet (although js is ideal) - I'm just looking for something a little cheaper than Aurigma at this stage of development.

Also, it may not be feasible for users to shrink the image themselves as in many instances they will uploading directly from an internet cafe or other public internet spot.

A: 

Without using applets or activex (only in windows) you can't execute anything on a client pc.

Keeper
This is not correct. For example, JavaScript is executed client-side, but it is - for very good reasons - lacking the permissions to access and modify local files.
0xA3
I was referring to the question about resizing images obviously.
Keeper
A: 

Probably not, but you can always insist that image uploads over x size will not succeed.

karim79
+2  A: 

Generally, it isn't possible to write an image compressor in JavaScript. Sorry.

You'll need to use a plugin of some sort, and as you mention, other sites use Java.

It appears to be possible to write something to encode a JPEG in ActionScript (i.e. Flash), which will reach a much larger audience than the Java plugin you mention. Here's a link to a blog post talking about PNG & JPEG encoders in ActionScript.

Here's another blog post with a demo of an inlined JPEG encoder in ActionScript.

slacy
A: 

Is this an application where you can force them to insert a smaller image. In that case you could grab the size first to verify it fits standards. This is what facebook used to do with profile pictures. If it was too big they wouldn't take it.

Justin Balvanz
+1  A: 

Only if you use Flash or Silverlight (only way to be cross-platform)

http://www.jeff.wilcox.name/2008/07/fjcore-source/ may be worth a read.

Nate Bross
FJcore looks really interesting but how common is it for a browser to have silverlight installed? - its a 4mb download otherwise, I'm starting to think Flash may be the way to go..
thief
Flash currently has a greater install base; but in my experiance Silverlight development is drastically more intuitive. If the browser does not have Silverlight, you can always show the standard upload control and do the processing server side.
Nate Bross