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

Web and WebWorks Development

Reply
Developer
Posts: 54
Registered: ‎10-05-2012
My Device: -
My Carrier: -
Accepted Solution

Save or upload image from blackberry webworks like web browser

Hi all,

 

I have developed app for BlackBerry os 7 or earlier using webworks.

But, when the app shows image (using <img src='.....' />), I can't find menu to save image like we could see in blackberry browser. How to show the menu for save image? 

 

What about upload images? I have tried extension webworks.io.FileUploader, but it always said that the extension is undefined. Is there any other extension for upload file (especially for images)?

 

Thanks.

 

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Save or upload image from blackberry webworks like web browser

Hi there, do you mean to bring up a Context Menu for the image inside a WebWorks application? It should come up by default for images you have added as long as you have not specified a custom Context Menu:

https://developer.blackberry.com/html5/apis/blackberry.ui.contextmenu.html

 

Are you able to share a basic index.html that you can produce the issue with?

 

For uploading, I would recommend the FileTransfer APIs:

https://developer.blackberry.com/html5/apis/blackberry.io.filetransfer.html


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Developer
Posts: 54
Registered: ‎10-05-2012
My Device: -
My Carrier: -

Re: Save or upload image from blackberry webworks like web browser

[ Edited ]

Thanks for your reply, oros.
Yes. It is the context menu for save the image. But, how to do it in blackberry os 7 or earlier? how to save image from <img src='...' /> to the local blackberry folder?

I am using bbui.js and the image is not in the index.html.
for example:
<div data-bb-type='screen' id='thePage'>
<img id='theImage' src='http://www......com/images/test.jpg' x-blackberry-focusable='true' onmouseover='highlight(this)' onmouseout='unhighlight(this) ' />
</div>

Regarding to the uploading, blackberry.io.filetransfer is used for blackberry 10. Is there any equivalent api for blackberry os 7 or earlier? or could we use the <input type='file' /> to upload file? Is there any documentation about this?

Thank you.

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Save or upload image from blackberry webworks like web browser

Ah, apologies. I missed the BBOS7 and earlier comment.

 

Indeed the FileUploader community API is the way to go:

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/FileUploader

 

Have you followed these steps to install the extension?

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/FileUploader#how-to-con...

 

Could you share a screenshot of the webworks.io.FileUploader folder, including the full path to the folder? Also, when you are packaging with the bbwp command, can you please share the full output of the packager, along with your config.xml file?

 

 

On Legacy BBOS, we don't have a context menu. You will actually need to write the filesystem access / saving implementation yourself. You may be able to re-use the FileDownload API:

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/FileDownloader

 

Or do something similar to the canvasToFilesystem sample here:

https://github.com/blackberry/BB10-WebWorks-Samples/blob/master/canvasToFilesystem/saveCanvas.js

 

Note that the canvasToFilesytem is for BB10, but the core API functionality is HTML5 so should work on BBOS7 and BBOS6.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Developer
Posts: 54
Registered: ‎10-05-2012
My Device: -
My Carrier: -

Re: Save or upload image from blackberry webworks like web browser

Hi oros,

 

I have tried FileUploader and FileDownloader but it is not working.

In the ripple emulator console, it shows error "webworks is undefined"

 

For FileUploader,

I have created webworks.io.FileUploader. It contains library.xml and folder webworks (that contains fileUploader source code).

 

For FileDownloader,

I have created webworks.io.FileDownloader. It contains library.xml and folder webworks (that contains fileDownloader source code).

 

In config.xml, I have added these lines:

<feature id='webworks.io.FileUploader' />

<feature id='webworks.io.FileDownloader' />

 

and I have arranged the <rim:connection>, too.

 

But, it is not working. I think I have made mistake when configuring the extension.

Could you help me?

 

Thank you.

 

 

 

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Save or upload image from blackberry webworks like web browser

Hi there,

Community Extensions would only be available inside of a packaged COD file. Have you tried on the simulator by chance?

The steps you have used to configure your environment appear to be correct. But again, they need to be packaged into a COD file to be available.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Developer
Posts: 54
Registered: ‎10-05-2012
My Device: -
My Carrier: -

Re: Save or upload image from blackberry webworks like web browser

I have packaged it and it works!

But, how to show the file picker when I want to upload a file, is this possible to use <input type='file' />?

Thanks.

Highlighted
BlackBerry Development Advisor
Posts: 841
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Save or upload image from blackberry webworks like web browser

The file input tag won't really do what you want, in the case of a WebWorks app. However, there is a community extension that provides a FilePicker. Check it out here:

 

https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone/FilePicker

Tim Windsor
Open Source Technical Lead
Developer
Posts: 54
Registered: ‎10-05-2012
My Device: -
My Carrier: -

Re: Save or upload image from blackberry webworks like web browser

Thank you twindsor.

The extensions are very helpful.

 

 

New Developer
Posts: 4
Registered: ‎10-07-2013
My Device: Bold5
My Carrier: MTN

Re: Save or upload image from blackberry webworks like web browser

Hello, I followed the description on how to install FileUploader extension just as you stated i the Readme file. Whenever I compile my app it returns the error: feature cannot be found in any extension

what must have caused this?