Hi everyone. I wonder if its posible to resize a huge image i.e. a 4MB jpg to a small 400x400 image BEFORE uploading to save bandwith. so the image will be about 30k instead 4 MB.

Currently I am uploading the huge file and resizing it after it gets to my server. the thing is if I have 100 user uploading a 4MB file at the same time the website start running sloooooowwwww. so I figured that if I could just find a way to resize the original image BEFORE uploading I could handle 100 users uploading a 30k file....

after a lot of research I found out several comercial products such Aurigma or Thinfile. that can do just that....

So why am I here? I dont really like te ActiveX(Aurigma) or the Java applet (ThinFile) solution since many users have problems whit it. but hey... everybody has flash right?.

I just found a pice of code claiming that it can resize an image client side using Flash 8. I wonder what you guys think about the following code:

Assuming there is a MovieClip on stage called imageMC, holding an image (100x100 pixels):
/***************CODE ***********************/

var myMatrix = new flash.geom.Matrix();
myMatrix.scale(.5, .5);

var myBitmapData = new flash.display.BitmapData(50, 50, true, 0x00FFFFFF);
myBitmapData.draw(imageMC, myMatrix);

var bitmapPixels:Array = new Array();
for(var i:Number = 0; i <= myBitmapData.width; i ++)
{
for(var j:Number = 0; j <= myBitmapData.height; j ++)
{
bitmapPixels.push(myBitmapData.getPixel32(i, j));
}
}

Now you have an array containing each pixels ARGB value of the 50% downscaled image... you could send it to a server and use the data to build an image from it...

note: depending on the image size the nested for loops could cause the flashplayer to run veeeeeery slowly...
/***************CODE ***********************/

the original post is here: http://forums.swishzone.com/index.php?showtopic=30097

please can anyone take a look at it... It will be awesome if swfupload could resize the images before uploading them.

thanks for your time.