Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Re: Code for saving an image to application local folder

Able to save the image as jpg from bytearray after using JPGEncoder with reasonable size(4.5kb image to 6.5kb) and in order to retieve it i need JPGDecoder, after googling and searching related documents im not able to find JPGDecoder. So pyth do you know any urls from where i can get this particular code/library.
Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: Code for saving an image to application local folder

How do you do that? Is there a predefined JPGEncoder in AS3? Link please :smileyhappy:

 

Anyway, I found this jpeg decoder, from thibault imbert

http://www.bytearray.org/?p=1089

there's a link to his library, and it looks very simple, hardly 100 lines of code. don't know about license though :smileyhappy:

 

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Code for saving an image to application local folder

Curious why you need to decode the JPEG image. If you are just displaying it, just use the Image class and point it to the file. It will decode and display it for you. If you need to decode then, you could access its bytearray from there.
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Re: Code for saving an image to application local folder

This is the link where i get the JPGEncoder lib. https://github.com/mikechambers/as3corelib/tree/master/src/com/adobe/images

 

And jtegen have a point, and i will check that too.

Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Re: Code for saving an image to application local folder

jtegen, this is the error i get when using image class.
Error #2044: Unhandled ioError:. text=Error #2124: Loaded file is an unknown type. URL: /accounts/1000/appdata/aabbcc.debug.testDev_Alarm_debug6384a473/shared/documents/images_small/smallimage1.jpg
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Code for saving an image to application local folder

How are you setting the URL to the image (code)?
Do you have permission to access the shared area?
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Re: Code for saving an image to application local folder

I tried following urls 

file:///accounts/1000/appdata/aabbcc.debug.testDev_Alarm_debug6384a473/shared/documents/images_small/smallimage1.jpg

 

 

and simply putting

/accounts/1000/appdata/aabbcc.debug.testDev_Alarm_debug6384a473/shared/documents/images_small/smallimage1.jpg

Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Re: Code for saving an image to application local folder

[ Edited ]

yeah, i already done that permission. 

<permission>access_shared</permission>  in my blackberry-tablet.xml

Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Re: Code for saving an image to application local folder

Thankyou pyth for your valuable help. The library you shown me worked like charm............... And jtegen im tried putting file path to the image class but im not able to view the image showing the same error i mentioned above.

 


Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Code for saving an image to application local folder

Odd. But if you got what you needed, great.