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

Reply
Developer
razorek
Posts: 67
Registered: ‎06-28-2012
My Device: BlackBerry Z10LE

FilePicker with imageCrop broken?

I have a simple QML page on which I have an ImagePicker attached object.

 

The application runs well if I don't set "imageCropEnabled = true" property.

But as soon as I add this line of code, the application won't even start - it is stuck on the spash image (BlackBerry on a gray background).

 

How do I use the imageCrop option? And where can I specify what dimensions to I want the resulting image to be (eg. I want it to be a squre 100x100 pixels).

 

Please help!

 

Here is the code:

import bb.cascades 1.0
import bb.cascades.pickers 1.0

Page {
    Container {
        background: Color.create ("#03AA25")
        
        layout: DockLayout {
        }
        
        Button {
            id: btnChooseImage
            text: qsTr ("Choose photo")
            onClicked: picker.open()
        }
        
    }
    
    attachedObjects: [
        FilePicker {
            id: picker

            property string selectedFile

            title: qsTr ("Choose photo")
            type: FileType.Picture
            imageCropEnabled: true
            
            onFileSelected: {
                selectedFile = selectedFiles[0]
            }
        }
    ]
}

 

Developer
razorek
Posts: 67
Registered: ‎06-28-2012
My Device: BlackBerry Z10LE

Re: FilePicker with imageCrop broken?

[ Edited ]

Please, has anyone found out how to open FilePicker with image crop?

Contributor
maheshkumar1990
Posts: 44
Registered: ‎01-07-2013
My Device: 9300

Re: FilePicker with imageCrop broken?

Hi

    have you find out solution for image crop

Developer
razorek
Posts: 67
Registered: ‎06-28-2012
My Device: BlackBerry Z10LE

Re: FilePicker with imageCrop broken?

I did managed to find a solution. If you create and use the FilePicker in C++ entirely, it works just fine... I thought that they would fix this issue in a newer SDKs, but I guess the issue is still there since you asked.

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: FilePicker with imageCrop broken?

This is working perfectly fine for me on 10.1 on the Z10. On my Dev Alpha C, it technically doesn't work but only (I believe) because the editor app is not included in the OS. It does still invoke the FilePicker even on the C, and simply gives an error toast that says "Target was not found" (in the picker) when I select an image.

The earlier posts were probably from before 10.1 was out, so maybe this was just an issue resolved in the new firmware.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
razorek
Posts: 67
Registered: ‎06-28-2012
My Device: BlackBerry Z10LE

Re: FilePicker with imageCrop broken?

Thanks for letting us know it now works on the Z10. I'll finally be able to skip the C++ for this :smileyhappy:

I've noticed that it doesn't work on Dev Alpha C. I think you are right about cause. Try your app in the simulator. It should work. It's funny that the simulator has more native apps then Dev Alpha C.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: FilePicker with imageCrop broken?

Seriously, the simulator has the photo editor included?! I find that funny, somehow... :smileyhappy:

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
dkonigs
Posts: 263
Registered: ‎07-25-2008
My Device: Passport

Re: FilePicker with imageCrop broken?

I've never had a problem using the crop mode on the FilePicker.  But then again, I've also only invoked the FilePicker from C++.

 

One thing I did find interesting, however, is how the behavior of this mode has changed from 10.0 to 10.1.

 

In 10.0, it shows a simple dedicated cropper screen.  In 10.1, it shows the full image editor with some special settings.