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

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 20
Registered: ‎07-27-2012
My Device: PlayBook / Z10 LE
My Carrier: PLUS GSM

Base64 encoded JPG and ImageView

Does anyone know how can I display Base64 encoded JPG image in ImageView? I have a string with base64 jpg and I would like to display it in ImageView. Preferably in QML. Saving to filesystem isn't the solution, as I have quite a few images to display in list.

Highlighted
Developer
Posts: 1,178
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Base64 encoded JPG and ImageView

[ Edited ]

UPDATE: Ok, this should work, but requires you to know some details about the jpeg you are decoding...

 

If the string is a QString, try something like this:

 

Image decodeImage( const QString& encodedImage, int width, int height, int bytesPerLine ) {
   return Image( ImageData&colon;:fromPixels( reinterpret_cast<unsigned char*>( encodedImage.toLatin1().data() ), width, height, bytesPerLine ) );
}

...and then plug the result into the ImageView. I haven't tested this, but it should work.

 


Saperus wrote:

Does anyone know how can I display Base64 encoded JPG image in ImageView? I have a string with base64 jpg and I would like to display it in ImageView. Preferably in QML. Saving to filesystem isn't the solution, as I have quite a few images to display in list.






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.