B4i Library iQBImagePicker - Multiple selection image picker

This is a wrapper for QBImagePicker https://github.com/questbeat/QBImagePicker, an image picker that provides for multiple image and video selection.

The wrapper includes helper functions which are primarily to copy the selected assets to a folder on the device but a few others have been included since I required them.

I have noticed that on the Simulator only local (in the DCIM folder) assets can be copied (not sure why) but on a real device I haven't noticed that limitation.

The list of PHAssetCollectionSubtypes (one or more of which are passed to the load function) can be found here https://github.com/mstg/iOS-full-sd...eworks/Photos.framework/Headers/PhotosTypes.h

QBImagePicker has built-in support for the following languages: English, French, German, Spanish, Italian, Korean, Japanese, Chinese Taiwan, Simplified Chinese, Portuguese, Polish, Russian.

Installation instructions (modified one of Alberto Iglesias' posts since I haven't tried the MAC HOSTED approach):

- Unzip QBImagePicker.zip into the folder "Libs" in your MAC or in your MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder. This will result in iQBImagePicker.h, libiQBImagePicker.a and the folder QBImagePicker.framework being copied to the "Libs" folder.

-Copy the iQBImagePicker.xml to your custom libraries folder in B4i

-If you wish to use the simulator then use QBImagePickerSim.zip instead of QBImagePicker.zip. (There are only two files that are different between the two zips: libiQBImagePicker.a and QBImagePicker.framework/QBImagePicker.)

22/01/21 - Updated the demo and XML file to remove the references to passing -1 as a subType since it doesn't work.

08/05/21 - ver 1.10
Added Russian language localisation.​

22/05/21 - ver 1.20
Added a call to add your own language translation.
If you wish to use QBImagePicker with a language that is not built-in to the framework, you can you the command QBImagePicker.translations to provide your own translations for the required 11 strings.​
Added a call to return the framework's version number: QBImagePicker.frameworkVersion​

For the non-English languages to be recognised, you need to create subfolders in your project's files/special folder as per this thread: https://www.b4x.com/android/forum/threads/tutorial-for-localization-of-app-name.69618

iQBImagePicker

Author: Capt Kronos
Version: 1.2
  • QBImagePicker
    • Events:
      • cancelled
      • picked (assets As List)
    • Functions:
      • convertPHAssetToImage (thePHAsset As PHAsset*) As UIImage*
        <code>dim bmp as bitmap = aQBImagePicker.ConvertPHAssetToImage(assets.Get(i))</code>
      • copyPHAssetToFile (ThePHAsset As PHAsset*, destination As NSString*)
        <code>aQBImagePicker.CopyPHAssetToFile(assets.Get(i), "filename")</code>
      • createAlbum (albumName As NSString*) As BOOL
        <code>aQBImagePicker.createAlbum("myalbum") 'if myalbum already exists another album of the same name will be created</code>
      • existsAlbum (albumName As NSString*) As BOOL
        <code>aQBImagePicker.existsAlbum("myalbum") 'returns true if myalbum exists</code>
      • frameworkVersion As NSString*
        Returns the version of the framework.
      • getImageDataFromAsset (thePHAsset As PHAsset*) As NSDictionary*
        Be very careful with this one. Depending on which key you inspect, it can crash your app.
        <code>Dim dict As Object, dictMap As Map
        dict=QBImagePicker.getImageDataFromAsset(assets.Get(0))
        dictMap=NSDictionaryToMap(dict)
        Log(dictMap.Get("PHImageFileUTIKey"))</code>
      • getImageURLFromAsset (thePHAsset As PHAsset*) As NSString*
        <code>Dim url As String=QBPicker.getImageURLFromAsset(assets.Get(i))
        url=url.SubString(7) 'convert to regular path and filename</code>
      • initialize (bi As B4I*, eventName As NSString*)
        Initialises the picker.
        Example:<code>aQBImagePicker.initialize("qbimagepicker")</code>
      • load (myViewController As UIViewController*, mediaType As Int, subType As NSArray*, multiSelect As BOOL, minNumber As Int, maxNumber As Int, numColsInPortrait As Int, numColsInLandscape As Int, useiCloud As BOOL)
        Displays the picker.
        MyViewController: The page to host the picker
        MediaType: 1 - images; 2 - videos; 0 - any
        SubType: a list of PHAssetCollectionSubtypes - see below for the values
        <code>github.com/mstg/iOS-full-sdk/blob/master/iPhoneOS9.3.sdk/System/Library/Frameworks/Photos.framework/Headers/PhotosTypes.h</code>
        MultiSelect: True - allows more than one asset to be selected
        MinNumber: The minimum number of assets that must be selected
        MaxNumber: The maximum number of assets that can be selected
        NumColsInPortrait: The number of assets to display horizontally when in portrait (0 for default value)
        NumColsInLandscape: The number of assets to display horizontally when in landscape (0 for default value)
        useiCloud: True - will display assets on iCloud
        Example:<code>
        aQBImagePicker.load(pg, 1, subType, True, 1, 100, 0, 0, True)</code>
      • saveImageFileToAlbum (albumName As NSString*, imageURL As NSString*) As BOOL
        <code>aQBImagePicker.saveImageFileToAlbum("myalbum", File.Combine(File.DirDocuments,"myimage.jpg"))</code>
      • saveImageToAlbum (albumName As NSString*, image As UIImage*) As BOOL
        <code>aQBImagePicker.saveImageToAlbum("myalbum", bmp)</code>
      • saveVideoFileToAlbum (albumName As NSString*, videoURL As NSString*) As BOOL
        <code>aQBImagePicker.saveVideoFileToAlbum("myalbum", File.Combine(File.DirDocuments,"myvideo.mp4"))</code>
      • translations (albumsTitle As NSString*, assetsToolbarItemsSelected As NSString*, assetsToolbarItemSelected As NSString*, assetsFooterPhotoAndVideo As NSString*, assetsFooterPhotoAndVideos As NSString*, assetsFooterPhotosAndVideo As NSString*, assetsFooterPhotosAndVideos As NSString*, assetsFooterPhoto As NSString*, assetsFooterPhotos As NSString*, assetsFooterVideos As NSString*, assetsFooterVideos As NSString*)
        Overrides built-in translations
        <code>aQBImagePicker.translations( _
        "Photos", _​
        "%ld Items Selected", _​
        "%ld Item Selected", _​
        "%ld Photo, %ld Video", _​
        "%ld Photo, %ld Videos", _​
        "%ld Photos, %ld Video", _​
        "%ld Photos, %ld Videos", _​
        "%ld Photo", _​
        "%ld Photos", _​
        "%ld Video", _​
        "%ld Videos")​
        </code>


Usage:
B4X:
Dim aQBImagePicker As QBImagePicker
Dim subType As List
subType.Initialize
subType.Add(201)
aQBImagePicker.initialize("QBImagePicker")
'optionally, add a translation (translate the English parameters to the required language)
aQBImagePicker.translations( _ 
	"Photos", _
	"%ld Items Selected", _
	"%ld Item Selected", _
	"%ld Photo, %ld Video", _
	"%ld Photo, %ld Videos", _
	"%ld Photos, %ld Video", _
	"%ld Photos, %ld Videos", _
	"%ld Photo", _
	"%ld Photos", _
	"%ld Video", _
	"%ld Videos")
aQBImagePicker.load(Page1,1,subType,True,0,10,0,0,True)

Sub QBImagePicker_picked (assets As List)
    For i=0 To assets.Size-1
        QBPicker.CopyPHAssetToFile(assets.Get(i), destFilname)
    Next
End Sub
 

Attachments

  • QBImagePickerDemo.zip
    2.8 KB · Views: 25
  • iQBImagePicker.xml
    10 KB · Views: 17
  • QBImagePicker.zip
    259.7 KB · Views: 19
  • QBImagePickerSim.zip
    372 KB · Views: 20
Last edited:

CaptKronos

Active Member
Licensed User
I have updated to the latest B4i beta including wiping the Builder's Libs folder and all works well.
Just in case you are still confused about when you should use the Arm version:
If you use the simulator when developing and debugging, use the regular version of QBImagePicker and then when submitting your app to the App Store remember to compile using the Arm version. (Apple does not like submissions which include x86 binaries, which is what the simulator uses.)
If you never use the simulator, use the Arm version and then you won't need to remember to make the switch before submitting to the App Store.
 

ilan

Expert
Licensed User
Longtime User
hi again, so i just had the chance to try the demo from post 1. for some reason when i opened the demo i already got an error that QBImagePicker.load() had to many parameters.

this is what was in the demo:

B4X:
QBImagePicker.load(Page1,1,subType,True,0,10,0,0,True)

and i changed it to

B4X:
QBImagePicker.load(Page1,1,subType,True,0,10,0,0)

now i am a little bit skeptical that if this demo works for you that i have maybe the wrong lib?? why does the demo works for you while i get an error that there are to many parameters??

anyway, after trying to compile i get again the error that i am not able to compile. i am trying on a real device with the ARM file. (the one with about 300kb)
 

ilan

Expert
Licensed User
Longtime User
tenor.gif

thank you so so much for your help, patient and lib. this is exactly what i needed to finish my project 😁

everything works fine now on my iPhone11 running iOS14 beta !

put your paypal account here i want to buy you a beer :)
 

lymey

Active Member
Licensed User
Longtime User
This is a wrapper for QBImagePicker https://github.com/questbeat/QBImagePicker, an image picker that provides for multiple image and video selection.

The wrapper includes helper functions which are primarily to copy the selected assets to a folder on the device but a few others have been included since I required them.

I have noticed that on the Simulator only local (in the DCIM folder) assets can be copied (not sure why) but on a real device I haven't noticed that limitation.

The list of PHAssetCollectionSubtypes (one or more of which are passed to the load function) can be found here https://github.com/mstg/iOS-full-sd...eworks/Photos.framework/Headers/PhotosTypes.h

Installation instructions (modified one of Alberto Iglesias' posts since I haven't tried the MAC HOSTED approach):

- Unzip QBImagePicker.zip into the folder "Libs" in your MAC or in your MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder. This will result in iQBImagePicker.h, libiQBImagePicker.a and the folder QBImagePicker.framework being copied to the "Libs" folder.

-Copy the iQBImagePicker.xml to your custom libraries folder in B4i

-If you wish to upload an app using iQBImagePicker to the App Store you will need to replace the file Libs\QBImagePicker.framework\QBImagePicker with the file in QBImagePickerARM.zip. The version of QBImagePicker in the zip only contains the ARM architectures. If you don't replace the file, the submission will be rejected by Apple due to the framework having unsupported architectures (i.e. X86).

iQBImagePicker

Author:
CaptKronos
Version: 1.0
    • QBImagePicker
      • iQBImagePicker.h iQBImagePicker Created by CaptKronos on 14/03/2019.
    • Events:
      • cancelled
      • picked (assets As List)
    • Functions:
      • convertPHAssetToImage (thePHAsset As PHAsset*) As UIImage*
        dim bmp as bitmap = aQBImagePicker.ConvertPHAssetToImage(assets.Get(i))
      • copyPHAssetToFile (ThePHAsset As PHAsset*, destination As NSString*)
        aQBImagePicker.CopyPHAssetToFile(assets.Get(i), "filename")
      • createAlbum (albumName As NSString*) As BOOL
        aQBImagePicker.createAlbum("myalbum") 'if myalbum already exists another album of the same name will be created
      • existsAlbum (albumName As NSString*) As BOOL
        aQBImagePicker.existsAlbum("myalbum") 'returns true if myalbum exists
      • getImageDataFromAsset (thePHAsset As PHAsset*) As NSDictionary*
        Be very careful with this one. Depending on which key you inspect, it can crash your app.
        Dim dict As Object, dictMap As Map
        dict=QBImagePicker.getImageDataFromAsset(assets.Get(0))
        dictMap=NSDictionaryToMap(dict)
        Log(dictMap.Get("PHImageFileUTIKey"))
      • getImageURLFromAsset (thePHAsset As PHAsset*) As NSString*
        Dim url As String=QBPicker.getImageURLFromAsset(assets.Get(i))
        url=url.SubString(7) 'convert to regular path and filename
      • initialize (bi As B4I*, eventName As NSString*)
        Initialises the picker.
        Example:aQBImagePicker.initialize("qbimagepicker")
      • load (myViewController As UIViewController*, mediaType As Int, subType As NSArray*, multiSelect As BOOL, minNumber As Int, maxNumber As Int, numColsInPortrait As Int, numColsInLandscape As Int, useiCloud As BOOL)
        Displays the picker.
        MyViewController: The page to host the picker
        MediaType: 1 - images; 2 - videos; 0 - any
        SubType: a list of PHAssetCollectionSubtypes - see below for the values or pass a list of one item, -1, to select all types
        github.com/mstg/iOS-full-sdk/blob/master/iPhoneOS9.3.sdk/System/Library/Frameworks/Photos.framework/Headers/PhotosTypes.h
        MultiSelect: True - allows more than one asset to be selected
        MinNumber: The minimum number of assets that must be selected
        MaxNumber: The maximum number of assets that can be selected
        NumColsInPortrait: The number of assets to display horizontally when in portrait (0 for default value)
        NumColsInLandscape: The number of assets to display horizontally when in landscape (0 for default value)
        useiCloud: True - will display assets on iCloud
        Example:
        aQBImagePicker.load(pg, 1, subType, True, 1, 100, 0, 0, True)
      • saveImageFileToAlbum (albumName As NSString*, imageURL As NSString*) As BOOL
        aQBImagePicker.saveImageFileToAlbum("myalbum", File.Combine(File.DirDocuments,"myimage.jpg"))
      • saveImageToAlbum (albumName As NSString*, image As UIImage*) As BOOL
        aQBImagePicker.saveImageToAlbum("myalbum", bmp)
      • saveVideoFileToAlbum (albumName As NSString*, videoURL As NSString*) As BOOL
        aQBImagePicker.saveVideoFileToAlbum("myalbum", File.Combine(File.DirDocuments,"myvideo.mp4"))

Usage:
B4X:
Dim aQBImagePicker As QBImagePicker
Dim subType As List
subType.Initialize
subType.Add(201)
aQBImagePicker.initialize("QBImagePicker")
aQBImagePicker.load(Page1,1,subType,True,0,10,0,0,True)

Sub QBImagePicker_picked (assets As List)
    For i=0 To assets.Size-1
        QBPicker.CopyPHAssetToFile(assets.Get(i), destFilname)
    Next
End Sub
Hi! can you ask Erel to add this to the hosted builder libraries. This won't work for people using the hosted builder servers. Many thanks!
 

CaptKronos

Active Member
Licensed User
To allow submissions to the App Store, I would suggest:

- Unzip iQBImagePicker-070720.zip (from the OP) into the folder "Libs" in the MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder. This will result in iQBImagePicker.h, libiQBImagePicker.a and the folder QBImagePicker.framework being copied to the "Libs" folder.

- Now replace the file Libs\QBImagePicker.framework\QBImagePicker with the file QBImagePicker which can be found in QBImagePickerARM.zip (from the OP).
 

lymey

Active Member
Licensed User
Longtime User
Personally I am using the hosted builder and b4i bridge to test on a real device. I am guessing the QBImagePickerARM.zip
 

lymey

Active Member
Licensed User
Longtime User
To allow submissions to the App Store, I would suggest:

- Unzip iQBImagePicker-070720.zip (from the OP) into the folder "Libs" in the MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder. This will result in iQBImagePicker.h, libiQBImagePicker.a and the folder QBImagePicker.framework being copied to the "Libs" folder.

- Now replace the file Libs\QBImagePicker.framework\QBImagePicker with the file QBImagePicker which can be found in QBImagePickerARM.zip (from the OP).
Hi CaptKronos, when using the Hosted Builder service, a developer does not have access to the libraries folder. So to use a new library the code has to be uploaded by Erel. In this case, for a developer to use the QBImagePicker you have to tell Erel which Library it should be. I am guessing that for testing on a real device and later release, it has to be QBImagePickerARM.zip. I am really looking forward to using this!
 

CaptKronos

Active Member
Licensed User
Hi CaptKronos, when using the Hosted Builder service, a developer does not have access to the libraries folder. So to use a new library the code has to be uploaded by Erel. In this case, for a developer to use the QBImagePicker you have to tell Erel which Library it should be. I am guessing that for testing on a real device and later release, it has to be QBImagePickerARM.zip. I am really looking forward to using this!
Yep, my suggestion was aimed at Erel.
 

lymey

Active Member
Licensed User
Longtime User
This is a wrapper for QBImagePicker https://github.com/questbeat/QBImagePicker, an image picker that provides for multiple image and video selection.

The wrapper includes helper functions which are primarily to copy the selected assets to a folder on the device but a few others have been included since I required them.

I have noticed that on the Simulator only local (in the DCIM folder) assets can be copied (not sure why) but on a real device I haven't noticed that limitation.

The list of PHAssetCollectionSubtypes (one or more of which are passed to the load function) can be found here https://github.com/mstg/iOS-full-sd...eworks/Photos.framework/Headers/PhotosTypes.h

Installation instructions (modified one of Alberto Iglesias' posts since I haven't tried the MAC HOSTED approach):

- Unzip QBImagePicker.zip into the folder "Libs" in your MAC or in your MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder. This will result in iQBImagePicker.h, libiQBImagePicker.a and the folder QBImagePicker.framework being copied to the "Libs" folder.

-Copy the iQBImagePicker.xml to your custom libraries folder in B4i

-If you wish to upload an app using iQBImagePicker to the App Store you will need to replace the file Libs\QBImagePicker.framework\QBImagePicker with the file in QBImagePickerARM.zip. The version of QBImagePicker in the zip only contains the ARM architectures. If you don't replace the file, the submission will be rejected by Apple due to the framework having unsupported architectures (i.e. X86).

iQBImagePicker

Author:
CaptKronos
Version: 1.0
    • QBImagePicker
      • iQBImagePicker.h iQBImagePicker Created by CaptKronos on 14/03/2019.
    • Events:
      • cancelled
      • picked (assets As List)
    • Functions:
      • convertPHAssetToImage (thePHAsset As PHAsset*) As UIImage*
        dim bmp as bitmap = aQBImagePicker.ConvertPHAssetToImage(assets.Get(i))
      • copyPHAssetToFile (ThePHAsset As PHAsset*, destination As NSString*)
        aQBImagePicker.CopyPHAssetToFile(assets.Get(i), "filename")
      • createAlbum (albumName As NSString*) As BOOL
        aQBImagePicker.createAlbum("myalbum") 'if myalbum already exists another album of the same name will be created
      • existsAlbum (albumName As NSString*) As BOOL
        aQBImagePicker.existsAlbum("myalbum") 'returns true if myalbum exists
      • getImageDataFromAsset (thePHAsset As PHAsset*) As NSDictionary*
        Be very careful with this one. Depending on which key you inspect, it can crash your app.
        Dim dict As Object, dictMap As Map
        dict=QBImagePicker.getImageDataFromAsset(assets.Get(0))
        dictMap=NSDictionaryToMap(dict)
        Log(dictMap.Get("PHImageFileUTIKey"))
      • getImageURLFromAsset (thePHAsset As PHAsset*) As NSString*
        Dim url As String=QBPicker.getImageURLFromAsset(assets.Get(i))
        url=url.SubString(7) 'convert to regular path and filename
      • initialize (bi As B4I*, eventName As NSString*)
        Initialises the picker.
        Example:aQBImagePicker.initialize("qbimagepicker")
      • load (myViewController As UIViewController*, mediaType As Int, subType As NSArray*, multiSelect As BOOL, minNumber As Int, maxNumber As Int, numColsInPortrait As Int, numColsInLandscape As Int, useiCloud As BOOL)
        Displays the picker.
        MyViewController: The page to host the picker
        MediaType: 1 - images; 2 - videos; 0 - any
        SubType: a list of PHAssetCollectionSubtypes - see below for the values or pass a list of one item, -1, to select all types
        github.com/mstg/iOS-full-sdk/blob/master/iPhoneOS9.3.sdk/System/Library/Frameworks/Photos.framework/Headers/PhotosTypes.h
        MultiSelect: True - allows more than one asset to be selected
        MinNumber: The minimum number of assets that must be selected
        MaxNumber: The maximum number of assets that can be selected
        NumColsInPortrait: The number of assets to display horizontally when in portrait (0 for default value)
        NumColsInLandscape: The number of assets to display horizontally when in landscape (0 for default value)
        useiCloud: True - will display assets on iCloud
        Example:
        aQBImagePicker.load(pg, 1, subType, True, 1, 100, 0, 0, True)
      • saveImageFileToAlbum (albumName As NSString*, imageURL As NSString*) As BOOL
        aQBImagePicker.saveImageFileToAlbum("myalbum", File.Combine(File.DirDocuments,"myimage.jpg"))
      • saveImageToAlbum (albumName As NSString*, image As UIImage*) As BOOL
        aQBImagePicker.saveImageToAlbum("myalbum", bmp)
      • saveVideoFileToAlbum (albumName As NSString*, videoURL As NSString*) As BOOL
        aQBImagePicker.saveVideoFileToAlbum("myalbum", File.Combine(File.DirDocuments,"myvideo.mp4"))

Usage:
B4X:
Dim aQBImagePicker As QBImagePicker
Dim subType As List
subType.Initialize
subType.Add(201)
aQBImagePicker.initialize("QBImagePicker")
aQBImagePicker.load(Page1,1,subType,True,0,10,0,0,True)

Sub QBImagePicker_picked (assets As List)
    For i=0 To assets.Size-1
        QBPicker.CopyPHAssetToFile(assets.Get(i), destFilname)
    Next
End Sub
Hi!
I am getting a nul url from
B4X:
Dim url As String=QBImagePicker.getImageURLFromAsset(assets.Get(0))
I amended this section of the example app:
B4X:
Sub qb_picked (assets As List )
    If assets.Size<>0 Then
     Log(assets.Get(0))
     theAssets=assets
        Dim url As String=QBImagePicker.getImageURLFromAsset(assets.Get(0))
        Log("url:" & url)
        url=url.SubString(7) 'convert to regular path and filename
        Log ("url substring: " & url)
     ImageView1.Bitmap=QBImagePicker.ConvertPHAssetToImage(assets.Get(0))
     Log ("Copy")
        QBImagePicker.CopyPHAssetToFile(assets.Get(0), "AcopiedFileName.jpg")
     pAsset=0
    End If
End Sub
Here is the log file:
Application_Start
Application_Active
<PHAsset: 0x102d70e20> ACB8BAC4-BD01-4CDA-BCB8-B23E6AB7D055/L0/001 mediaType=1/8, sourceType=1, (3024x4032), creationDate=2020-06-30 5:34:11 pm +0000, location=0, hidden=0, favorite=0, adjusted=0
url:<null>
Error occurred on line: 53 (Main)
Target is null. Method called: SubString:
Stack Trace: (
CoreFoundation F80FCA31-BF76-3293-8BC6-1729588AE8B6 + 1155368
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation F80FCA31-BF76-3293-8BC6-1729588AE8B6 + 119500
QBImagePickerDemo +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 172
QBImagePickerDemo -[B4IShell runMethod:] + 448
QBImagePickerDemo -[B4IShell raiseEventImpl:method:args::] + 1648
QBImagePickerDemo -[B4IShellBI raiseEvent:event:params:] + 1580
QBImagePickerDemo +[B4IObjectWrapper raiseEvent:::] + 300
QBImagePickerDemo -[iQBImagePicker qb_imagePickerController:didFinishPickingAssets:] + 228
QBImagePicker -[QBAssetsViewController done:] + 292
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 11697492
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 1172664
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 1014052
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 1013720
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 11697492
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 4983488
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 4984324
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 4978492
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 11938856
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 11945296
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 11794740
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 12327456
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 12345792
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 12309632
CoreFoundation F80FCA31-BF76-3293-8BC6-1729588AE8B6 + 631360
CoreFoundation F80FCA31-BF76-3293-8BC6-1729588AE8B6 + 631104
CoreFoundation F80FCA31-BF76-3293-8BC6-1729588AE8B6 + 627848
CoreFoundation F80FCA31-BF76-3293-8BC6-1729588AE8B6 + 604736
CoreFoundation CFRunLoopRunSpecific + 572
GraphicsServices GSEventRunModal + 160
UIKitCore 00EA1426-38F7-3FD2-BE01-04EBD44ECA35 + 11669508
UIKitCore UIApplicationMain + 164
QBImagePickerDemo main + 128
libdyld.dylib 77E57314-8A58-3064-90C0-8AF9A4745430 + 5528
)
 

lymey

Active Member
Licensed User
Longtime User
Hi! another question,
where does
B4X:
QBImagePicker.CopyPHAssetToFile(assets.Get(0), "AcopiedFileName.jpg")
copy the file to?
Many thanks, for getting this running on the Hosted Builder platform.
 

CaptKronos

Active Member
Licensed User
Hi! another question,
where does
B4X:
QBImagePicker.CopyPHAssetToFile(assets.Get(0), "AcopiedFileName.jpg")
copy the file to?
Many thanks, for getting this running on the Hosted Builder platform.
It will copy the file to whatever is the current folder. I would suggest that you explicitly state where you want the file saved:
B4X:
QBPicker.CopyPHAssetToFile(assets.Get(i), File.Combine(Folder, Filename))
 

CaptKronos

Active Member
Licensed User
Hi!
I am getting a nul url from
B4X:
Dim url As String=QBImagePicker.getImageURLFromAsset(assets.Get(0))
I amended this section of the example app:
Not sure why you are getting a nul url though I noticed you are trying to get a very large image. Perhaps try with a smaller one to start with?
Is QBImagePicker.CopyPHAssetToFile working for you?
 

CaptKronos

Active Member
Licensed User
Not sure why you are getting a nul url though I noticed you are trying to get a very large image. Perhaps try with a smaller one to start with?
Is QBImagePicker.CopyPHAssetToFile working for you?
If you put a breakpoint on your line
B4X:
Log("url:" & url)
you should be able to view the value of assets and within the values returned you should be able to find the directory and filename values. Are the values present for you?
Screenshot.jpg
 

lymey

Active Member
Licensed User
Longtime User
It will copy the file to whatever is the current folder. I would suggest that you explicitly state where you want the file saved:
B4X:
QBPicker.CopyPHAssetToFile(assets.Get(i), File.Combine(Folder, Filename))
Yes, adding the explicit folder filename works. Thanks!
 

CaptKronos

Active Member
Licensed User
It would be nice to know why you are getting the nul URL but if you just need the filename and directory, the following (not tested) should work:

B4X:
Dim no As NativeObject=assets.Get(0)
Dim fn As String=no.GetField("_filename").AsString
Dim dir As String=no.GetField("_directory").AsString
 
Top