Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Resizing images

Avatar

Avatar
Validate 1
Level 1
Syferius
Level 1

Like

1 like

Total Posts

13 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
Syferius
Level 1

Like

1 like

Total Posts

13 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
Syferius
Level 1

17-03-2009

Is there any solution to resize images that users are
uploading ? I was trying to resize it before upload, but i can't
change FileReference's data without resaving resized image and
rebrowsing it. Please advise. Thanks.

Replies

Avatar

Avatar
Boost 5
Employee
aponnusa
Employee

Likes

46 likes

Total Posts

455 posts

Correct Reply

53 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile

Avatar
Boost 5
Employee
aponnusa
Employee

Likes

46 likes

Total Posts

455 posts

Correct Reply

53 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile
aponnusa
Employee

17-03-2009

You can always access the actual image as bytearray from the
file reference. And then manipulate the bytearray to create a new
resized image.



Ex:

protected function init():void

var actualImage:ByteArray = new ByteArray();

actualImage = _fileReference.data as ByteArray;

var loader:Loader = new Loader();


loader.contentLoaderInfo.addEventListener(Event.COMPLETE,byteImageLoaded);

loader.loadBytes(actualImage);

}



protected function byteImageLoaded(p_event:Event):void

{

//Explore alternative ways to create a Thumbnail

var sourceBMP:Bitmap = p_event.currentTarget.loader.content
as Bitmap;

//ur logic to resize the bitmap

}



Thanks

Avatar

Avatar
Validate 1
Level 1
Syferius
Level 1

Like

1 like

Total Posts

13 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
Syferius
Level 1

Like

1 like

Total Posts

13 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
Syferius
Level 1

17-03-2009

Yes. This is done for now. But after this manipulations, i
want to return ByteArray to FileReference.data and then
FilePublisher.uploadFileReference(). This is my problem.

Avatar

Avatar
Boost 5
Employee
aponnusa
Employee

Likes

46 likes

Total Posts

455 posts

Correct Reply

53 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile

Avatar
Boost 5
Employee
aponnusa
Employee

Likes

46 likes

Total Posts

455 posts

Correct Reply

53 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile
aponnusa
Employee

17-03-2009

Use mx.graphics.codec.PNGEncoder or jpeg encoder to encode
the byte array as png or jpg image. Then use the binary publisher {

http://livedocs.adobe.com/labs/acrobatcom/com/adobe/rtc/collaboration/BinaryPublisher.html
} to save it as a file. (binaryPublisher.publish(args...))

Avatar

Avatar
Validate 1
Level 1
Syferius
Level 1

Like

1 like

Total Posts

13 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
Syferius
Level 1

Like

1 like

Total Posts

13 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
Syferius
Level 1

18-03-2009

Thanks. This what i need.