@Jean17 wrote:
use native document viewer open pdf document with password setting is crash on ios, but it’s work on androild
Posts: 1
Participants: 1
@Jean17 wrote:
use native document viewer open pdf document with password setting is crash on ios, but it’s work on androild
Posts: 1
Participants: 1
@karapazar wrote:
Hello. I get a problem when build for android. I search my problem and apply but no there solution for me.
ionic cordova build android > ionic-app-scripts build --target cordova --platform android [11:39:08] ionic-app-scripts 3.2.2 [11:39:08] build dev started ... [11:39:08] clean started ... [11:39:08] clean finished in 10 ms [11:39:08] copy started ... [11:39:08] deeplinks started ... [11:39:08] deeplinks finished in 89 ms [11:39:08] transpile started ... [11:39:12] transpile finished in 4.23 s [11:39:12] preprocess started ... [11:39:12] preprocess finished in less than 1 ms [11:39:12] webpack started ... [11:39:13] copy finished in 4.50 s [11:39:17] webpack finished in 5.03 s [11:39:17] sass started ... [11:39:19] sass finished in 1.11 s [11:39:19] postprocess started ... [11:39:19] postprocess finished in 12 ms [11:39:19] lint started ... [11:39:19] build dev finished in 10.60 s [11:39:22] tslint: C:/Data/kameraYonetim/src/services/helpers/helpers.ts, line: 28 Property 'networkInterface' is declared but its value is never read. L27: private toast: Toast, L28: private networkInterface: NetworkInterface, L29: private storage: Storage, [11:39:22] lint finished in 3.29 s > cordova build android cordova-android-support-gradle-release: Android platform: V6 cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\Data\kameraYonetim\platforms\android\build.gradle cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\Data\kameraYonetim\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle cordova-android-support-gradle-release: Android platform: V6 cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\Data\kameraYonetim\platforms\android\build.gradle cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\Data\kameraYonetim\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle ANDROID_HOME=C:\Users\omers\AppData\Local\Android\Sdk JAVA_HOME=C:\Program Files\java\jdk1.8.0_152 :wrapper BU�LD SUCCESSFUL in 1s 1 actionable task: 1 executed Subproject Path: CordovaLib Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details +----------------------------------------------------------------- | cordova-android-support-gradle-release: 27.+ +----------------------------------------------------------------- The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. at build_5mpcat99bje0wpj6bcyr2h888.run(C:\Data\kameraYonetim\platforms\android\build.gradle:143) The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0. Incremental java compilation is an incubating feature. The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead. :preBuild UP-TO-DATE :preDebugBuild UP-TO-DATE :checkDebugManifest :preReleaseBuild UP-TO-DATE :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild UP-TO-DATE :CordovaLib:checkDebugManifest :CordovaLib:prepareDebugDependencies :CordovaLib:compileDebugAidl :CordovaLib:compileDebugNdk UP-TO-DATE :CordovaLib:compileLint :CordovaLib:copyDebugLint UP-TO-DATE :CordovaLib:mergeDebugShaders :CordovaLib:compileDebugShaders :CordovaLib:generateDebugAssets :CordovaLib:mergeDebugAssets :CordovaLib:mergeDebugProguardFiles :CordovaLib:packageDebugRenderscript UP-TO-DATE :CordovaLib:compileDebugRenderscript :CordovaLib:generateDebugResValues :CordovaLib:generateDebugResources :CordovaLib:packageDebugResources :CordovaLib:processDebugManifest :CordovaLib:generateDebugBuildConfig :CordovaLib:processDebugResources :CordovaLib:generateDebugSources :CordovaLib:incrementalDebugJavaCompilationSafeguard :CordovaLib:compileDebugJavaWithJavac :CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. :CordovaLib:processDebugJavaRes UP-TO-DATE :CordovaLib:transformResourcesWithMergeJavaResForDebug :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug :CordovaLib:mergeDebugJniLibFolders :CordovaLib:transformNat�ve_l�bsWithMergeJniLibsForDebug :CordovaLib:transformNat�ve_l�bsWithSyncJniLibsForDebug :CordovaLib:bundleDebug :CordovaLib:preReleaseBuild UP-TO-DATE :CordovaLib:checkReleaseManifest :CordovaLib:prepareReleaseDependencies :CordovaLib:compileReleaseAidl :CordovaLib:compileReleaseNdk UP-TO-DATE :CordovaLib:copyReleaseLint UP-TO-DATE :CordovaLib:mergeReleaseShaders :CordovaLib:compileReleaseShaders :CordovaLib:generateReleaseAssets :CordovaLib:mergeReleaseAssets :CordovaLib:mergeReleaseProguardFiles :CordovaLib:packageReleaseRenderscript UP-TO-DATE :CordovaLib:compileReleaseRenderscript :CordovaLib:generateReleaseResValues :CordovaLib:generateReleaseResources :CordovaLib:packageReleaseResources :CordovaLib:processReleaseManifest :CordovaLib:generateReleaseBuildConfig :CordovaLib:processReleaseResources :CordovaLib:generateReleaseSources :CordovaLib:incrementalReleaseJavaCompilationSafeguard :CordovaLib:compileReleaseJavaWithJavac :CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. :CordovaLib:processReleaseJavaRes UP-TO-DATE :CordovaLib:transformResourcesWithMergeJavaResForRelease :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease :CordovaLib:mergeReleaseJniLibFolders :CordovaLib:transformNat�ve_l�bsWithMergeJniLibsForRelease :CordovaLib:transformNat�ve_l�bsWithSyncJniLibsForRelease :CordovaLib:bundleRelease :prepareAndroidArchCoreRuntime110Library :prepareAndroidArchLifecycleLivedataCore110Library :prepareAndroidArchLifecycleRuntime110Library :prepareAndroidArchLifecycleViewmodel110Library :prepareComAndroidSupportSupportCompat2711Library :prepareComAndroidSupportSupportCoreUi2711Library :prepareComAndroidSupportSupportCoreUtils2711Library :prepareComAndroidSupportSupportFragment2711Library :prepareComAndroidSupportSupportMediaCompat2711Library :prepareComAndroidSupportSupportV42711Library :prepareComCommit451PhotoView124Library :prepareOrgApacheCordovaCordovaLib630DebugLibrary :prepareDebugDependencies :compileDebugAidl :compileDebugRenderscript :generateDebugBuildConfig :generateDebugResValues :generateDebugResources :mergeDebugResources :processDebugManifest C:\Data\kameraYonetim\platforms\android\res\xml\config.xml:45:53-81: AAPT: No resource found that matches the given name (at 'networkSecurityConfig' with value '@xml/network_security_config'). :processDebugResources FAILED C:\Data\kameraYonetim\platforms\android\build\intermediates\res\merged\debug\xml\config.xml:45: error: Error: No resource found that matches the given name (at 'networkSecurityConfig' with value '@xml/network_security_config'). FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BU�LD FAILED Total time: 17.935 secs Error: cmd: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. C:\Data\kameraYonetim\platforms\android\res\xml\config.xml:45:53-81: AAPT: No resource found that matches the given name (at 'networkSecurityConfig' with value '@xml/network_security_config'). C:\Data\kameraYonetim\platforms\android\build\intermediates\res\merged\debug\xml\config.xml:45: error: Error: No resource found that matches the given name (at 'networkSecurityConfig' with value '@xml/network_security_config'). FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt * Try: [ERROR] An error occurred while running subprocess cordova. cordova build android exited with exit code 1. Re-running this command with the --verbose flag may provide more information.
please help me.
Posts: 1
Participants: 1
@Doomkin wrote:
Dear fellow devs,
I’m trying to setup a global function that let me track user’s navigation though the pages of my app.
I would like to have one single file that handle everything, and I would like to NOT include a service in every page for it to work.Is there a way to setup a listener that listen for page changes at the start of my app instead of let’s say include a NavService in every page and execute the method this.nav.pageChanged() on every page’s ngOnInit() ?
Thanks!
Posts: 1
Participants: 1
@jeff-panart wrote:
Hi,
Using Ionic v4, we are building an app with some API post requests to a external source. All posts work and now we want to build our app. We get stuck with the ‘no build tools found’ message.
We double (even triple) checked and we do have the build tools installed.Could there be any other bug preventing the build?
Posts: 1
Participants: 1
@Sebotage wrote:
Hi peeps! I followed the tutorial from the ionic blog to set up a vue-ionic project.
https://blog.ionicframework.com/announcing-the-ionic-vue-beta/The thing is, I’m not able to scroll… at all?
I just added some cards to try out a few things, and realised I can’t scroll down so I can’t see all of my content, why is this?<template> <ion-card> <ion-card-header style="text-align: center;"> <ion-card-subtitle>Welcome</ion-card-subtitle> <ion-card-title>Whisky</ion-card-title> </ion-card-header> <ion-card-content> Blablablabla </ion-card-content> </ion-card> </template>
I’ve just copy-pasted this card multiple times, not done anything else, does anyone know what’s causing this issue?
Posts: 1
Participants: 1
@brettbutcher wrote:
Hi, I am evaluating Ionic 4 Angular 7 for a project and am trying to use Ion-select to set/edit a measurement type in Miles or Kilometers. It is set from a Typescript Enum ‘DistanceMeasure’ and comes from the server in the user profile data.
When it first displays, the select always shows the placeholder ‘Please select’ rather than the current value, which I am pretty sure is set but happy to be shown if I’m wrong.
The html is like this:<form [formGroup]="businessUserDetailsForm" (ngSubmit)="onSubmit()"> <ion-row> <ion-col width-25> <ion-item> <ion-label position="floating">Max Travel Distance</ion-label> <ion-input type="text" formControlName="MaxTravelDistance"></ion-input> </ion-item> </ion-col> <ion-col width-25> <ion-item> <ion-label position="floating">in:</ion-label> <ion-select placeholder="Please Select" formControlName="DistanceMeasure" value = {{userdata.BusinessUser.DistanceMeasure}}> <ion-select-option value=0>Miles</ion-select-option> <ion-select-option value=1>Kilometers</ion-select-option> <!-- <ion-select-option *ngFor="let k of distkeys; let i= index" value ={{i}} > {{ k }} </ion-select-option> --> </ion-select> </ion-item> </ion-col> </ion-row> <ion-button expand="full" type="submit">Submit</ion-button> </form>
In the Ion-select line, I have also tried 'value =0, and value =“0” as I’m not certain of the format there…
The commented out line shows how I intend to make it work using the enum, but I have commented it out to avoid confusion and the simple case shown does just the same.
The page code is like this:ngOnInit() { // This is the business USER form this.businessUserDetailsForm = this.formBuilder.group({ Id: [], Business: [], MaxTravelDistance: [], DistanceMeasure: [], ... more stuff }); this.userService.getUserStore().then((user: UserData) => { console.log('have set the user'); this.userdata = user; this.businessUserDetailsForm.patchValue(user.BusinessUser); this.distmeasure = DistanceMeasure[user.BusinessUser.DistanceMeasure]; }); }
This Ionic documentation says that you should set the value in the select line to display it but it doesn’t. It always shows the placeholder. What am I missing? Can anyone shed any light?
Many thanks.
Posts: 1
Participants: 1
@yogeshyoyo wrote:
Hi. i am using 2 split-pane, firstmenu/firstpage will be my home screen. from firstpage i am navigating to secondmenu/secondpage. now when i return back to firstmenu/firstpage, the split-pane is getting hide. this is stopper for my application, can you help on this please. see the screenshot.
firstmenu/firstpag:
secondmenu/secondpage:
firstmenu/firstpage:
Posts: 1
Participants: 1
@Doomkin wrote:
Hello,
I have the following html:
<ion-item> <ion-label position="floating">Choose one...</ion-label> <ion-select cancel-text="Cancel" name="selectedPest" [(ngModel)]="selectedPest" (ionChange)="pestSelected()"> <ion-select-option *ngFor="let selectable of selectablePests" value="{{selectable.id}}">{{selectable.name}}</ion-select-option> </ion-select> </ion-item>
and the following ts
pestSelected() { this.selectablePests = this.selectablePests.filter(pest => { return +this.selectedPest !== pest.id; }); }
The issue is that the options are not refreshed when I remove items from the array.
If I put a console.log after the filter, the array has the correct items, but the options are still there even if I removed them.If I do
pestSelected() { this.selectablePests.push({id: 999, name: 'test'}); }
The new item is present in the select options.
Am I missing something?
Thanks!
Posts: 1
Participants: 1
@hugo75 wrote:
use video tag and audio but not work in android 7 with chrome v51. Run without problems in android 8.
the audio / video works with an external url, but with a local file in the directory android / data / app / … it does not finish loading and finally it fails. to get the route I use WebView.convertFileSrc. The tests you perform indicate that the file exists (with which the path is correct) but does not load. The same file hosted on an external server and indicating the url works without any problem.
use:
ionic v4.12
Cordova v12
Posts: 1
Participants: 1
@samir94 wrote:
Facebook login working fine in development mode and no error getting from FB return. But it happened a big problem when I will try to login with facebook after downloaded from the play store. It getting still error.
Login Error: there is an error in logging you into this application. Please try again later.
Posts: 1
Participants: 1
@TheAnonymousMode wrote:
Hi,
Angular 8 is not available. Is it compatible with Ionic 4 app? My dependencies are:
"@ionic-native/core": "^5.0.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/status-bar": "^5.0.0", "@ionic/angular": "^4.1.0",
Thx
Posts: 1
Participants: 1
@swanand6300 wrote:
Hi All,
I tried to upload my image file using REST api with form data but every time i get this below error.
TypeError: Cannot read property ‘length’ of undefined
at Object.keys.forEach.name (vendor.js:7159)
at Array.forEach ()
at HttpHeaders.lazyInit (vendor.js:7151)
at HttpHeaders.init (vendor.js:7267)
at HttpHeaders.forEach (vendor.js:7357)
at Observable.rxjs__WEBPACK_IMPORTED_MODULE_1__.Observable [as _subscribe] (vendor.js:8756)
at Observable._trySubscribe (vendor.js:100672)
at Observable.subscribe (vendor.js:100658)
at subscribeToResult (vendor.js:110705)
at MergeMapSubscriber._innerSub (vendor.js:105935)I have no clue why this is happening. Please help
Posts: 1
Participants: 1
@Nasco wrote:
Hi there, I have the following structure
<ion-slides> <ion-slide> <button tappable (click)="executeClickFunc()" (press)="executePressFunc()">Button 1</button> </ion-slide> <ion-slide> <button tappable (click)="executeClickFunc()" (press)="executePressFunc()">Button 2</button> </ion-slide> <ion-slide> <button tappable (click)="executeClickFunc()" (press)="executePressFunc()">Button 3</button> </ion-slide> <ion-slides>
So the issue comes when on
executePressFunc()
I’m opening a modal (with the modalController) , and after modal closing, the slides are still being dragged (left or right) when moving with the mouse ( the focus on the slider is not lost ).I’ve tried many things like lockSwipes(), touchRatio , also tried to swiperWrapper.blur() the swiper wrapper before the modal opens so it can lose focus… nothing works… Would appreciate any help.
Posts: 1
Participants: 1
@sagarpatil18 wrote:
We are integrating Microsoft office 365 with Keycloak Identity Server where we are facing an issue while building an IOS APP
The same build Android is Working fine but while running on IOS I am getting the this below error2019-05-29 17:19:58.682617+0530 AttraLIVE[38809:642378] [] nw_socket_handle_socket_event [C13.1:2] Socket SO_ERROR [61: Connection refused]
2019-05-29 17:19:58.685005+0530 AttraLIVE[38809:642378] [] nw_socket_handle_socket_event [C13.2:2] Socket SO_ERROR [61: Connection refused]
2019-05-29 17:19:58.685736+0530 AttraLIVE[38809:642378] TIC TCP Conn Failed [13:0x600000c6c480]: 1:61 Err(61)
2019-05-29 17:19:58.689168+0530 AttraLIVE[38809:642378] Task <9D4D3BBD-656E-4B84-AD79-1672229058CB>.<0> HTTP load failed (error code: -1004 [1:61])
2019-05-29 17:19:58.690264+0530 AttraLIVE[38809:642378] NSURLConnection finished with error - code -1004
2019-05-29 17:19:58.706103+0530 AttraLIVE[38809:642159] ERROR: Error initalizing Keycloak in main.ts Error: No NgModule metadata found for ‘function (){}’.
2019-05-29 17:19:58.708662+0530 AttraLIVE[38809:642159] webView:didFailLoadWithError - -1004: Could not connect to the server.
2019-05-29 17:21:47.670971+0530 AttraLIVE[38809:643524] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fd8e5f1d670] get output frames failed, state 8196
2019-05-29 17:21:47.671170+0530 AttraLIVE[38809:643524] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x7fd8e5f1d670] get output frames failed, state 8196
2019-05-29 17:21:47.672004+0530 AttraLIVE[38809:643524] TIC Read Status [1:0x0]: 1:57
2019-05-29 17:21:47.672131+0530 AttraLIVE[38809:643524] TIC Read Status [1:0x0]: 1:57
2019-05-29 17:21:48.588899+0530 AttraLIVE[38809:643524] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C5.1:2][0x7fd8e5f2d750] get output frames failed, state 8196
2019-05-29 17:21:48.589294+0530 AttraLIVE[38809:643524] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C5.1:2][0x7fd8e5f2d750] get output frames failed, state 8196
2019-05-29 17:21:48.589714+0530 AttraLIVE[38809:643524] TIC Read Status [5:0x0]: 1:57
2019-05-29 17:21:48.589810+0530 AttraLIVE[38809:643524] TIC Read Status [5:0x0]: 1:57
2019-05-29 17:22:02.464466+0530 AttraLIVE[38809:643526] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C14.1:2][0x7fd8e5f2c1d0] get output frames failed, state 8196
2019-05-29 17:22:02.464643+0530 AttraLIVE[38809:643526] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C14.1:2][0x7fd8e5f2c1d0] get output frames failed, state 8196
2019-05-29 17:22:02.465100+0530 AttraLIVE[38809:643526] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C15.1:2][0x7fd8e5f6b970] get output frames failed, state 8196
2019-05-29 17:22:02.465273+0530 AttraLIVE[38809:643526] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C15.1:2][0x7fd8e5f6b970] get output frames failed, state 8196
2019-05-29 17:22:02.465589+0530 AttraLIVE[38809:643526] TIC Read Status [14:0x0]: 1:57
2019-05-29 17:22:02.465741+0530 AttraLIVE[38809:643526] TIC Read Status [14:0x0]: 1:57
2019-05-29 17:22:02.466111+0530 AttraLIVE[38809:643526] TIC Read Status [15:0x0]: 1:57
2019-05-29 17:22:02.466236+0530 AttraLIVE[38809:643526] TIC Read Status [15:0x0]: 1:57
2019-05-29 17:23:47.682834+0530 AttraLIVE[38809:644073] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C3.1:2][0x7fd8e5c33fb0] get output frames failed, state 8196
2019-05-29 17:23:47.683078+0530 AttraLIVE[38809:644073] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C3.1:2][0x7fd8e5c33fb0] get output frames failed, state 8196
2019-05-29 17:23:47.683438+0530 AttraLIVE[38809:644073] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C4.1:2][0x7fd8e5c3e9f0] get output frames failed, state 8196
2019-05-29 17:23:47.683613+0530 AttraLIVE[38809:644073] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C4.1:2][0x7fd8e5c3e9f0] get output frames failed, state 8196
I tried many ways in most of the forum I have seen its related ATS network related issue to overcome that I added below code into info.plist
NSAppTransportSecurity
NSAllowsArbitraryLoads
NSExceptionDomains
NSIncludesSubdomains
NSExceptionAllowsInsecureHTTPLoads
NSExceptionMinimumTLSVersion
TLSv1.1
But still no luck we are getting the same error
Posts: 1
Participants: 1
@wilprim wrote:
I am playing around with Ionic and am trying to figure out how to build a UI that doesn’t include a header and toolbar. When I try to do this, however, all my content doesn’t get padded down below status bar (and notch for iPhone x) Is there a way to do this? I have thought about adding a padding-top to the and then changing that padding using the Platform utility but I want to first see if there is something easier I may be missing.
Here is my code for the content:
<ion-content> <ion-list lines='full'> <ion-list-header> Todos </ion-list-header> <ion-item-sliding *ngFor="let todo of todos"> <ion-item-options> <ion-item-option side="end"> Delete </ion-item-option> </ion-item-options> <ion-item> <ion-label> {{ todo.data.title }} </ion-label> </ion-item> </ion-item-sliding> </ion-list> <ion-infinite-scroll threshold="0" (ionInfinite)="loadData($event)"> <ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="Loading more data..."> </ion-infinite-scroll-content> </ion-infinite-scroll> </ion-content>
Here is a screenshot of iphone 8 and X (pardon my drawing for the notch ;))
Posts: 1
Participants: 1
@jimzim111 wrote:
Hi,
Can anyone offer advice on this problem I’m encountering: I have a simple ionic-v4 app using @ionic-native/barcode-scanner/ngx. When I run in the android emulator (new installation of API 29), it opens and starts scanning. I configured the emulator camera to see a QR code on the “wall”.
After using the camera controls to “navigate” to a clear view of the QR code on the wall, the barcode scanner plugin can see the QR code’s position/alignment points, and flashes little dots on each point indicating it recognizes the QR code. It also smoothly tracks those position points as I move around while facing the QR code.
However, the promise I received from the BarcodeScanner.scan() doesn’t get resolved, even while the scanner has a very clear view of the code, and is constantly tracking its position. The scanner just stays open and stares at the QR code. Then after a couple minutes, the promise does get resolved, with no data and BarcodeScannerResult.canceled=true;
Any ideas what would cause this or how I could troubleshoot?
Thanks,
Jim
Posts: 1
Participants: 1
@SanduCuragau wrote:
Tl:DR: i keep images as base64 strings in the database but I wanna start saving them as binary because i’ve heard it occupies less space. I don’t know where to get started in converting the image to binary and the binary to image.
Hey I have an app where I use camera plugin and allow the users to browse through their gallery and choose an image to use as their profile’s avatar, that image when chosen is returned as a base64 string and saved on the database in the user’s table. Later the app can get his database row and keep it as an object locally, which brings the image as a property and then I simply make an img take the base64 string and it displays the image just like that.
PS: im using mysql
Thing is, I read a post on stackoverflow where an user said how base64 strings are 33% heavier than saving right away the binary of the image, so I’m now wondering, how can I achieve this? I’ve googled around but didn’t figure anything out.
Code I use to get the image and then update the image locally and also update the database with that image
async getPhoto(sourceType:number) { const options: CameraOptions = { quality: 100, targetHeight: 300, destinationType: this.camera.DestinationType.DATA_URL, encodingType: this.camera.EncodingType.JPEG, mediaType: this.camera.MediaType.PICTURE, correctOrientation: true, sourceType: sourceType, saveToPhotoAlbum: false, allowEdit: true } this.camera.getPicture(options).then((imageData) => { let base64Image = 'data:image/jpeg;base64,' + imageData; // set the image locally but also update the database this.authenticationService.utilizador.avatar = base64Image; this.utilizadorService.update(this.authenticationService.utilizador); }, (err) => { // Handle error }); }
This is me using the image
<ion-avatar class="custom-avatar"> <img src="{{this.authenticationService.utilizador.avatar}}" alt="" srcset=""> </ion-avatar>
Posts: 1
Participants: 1
@ctfrancia wrote:
I am using Ionic-4 (there is no option to specify v4 in the tags) and I cannot make a Modal Service without creating a Circular Dependency.
import { ModalController } from '@ionic/angular'; @Injectable({ providedIn: 'root' }) export class ModalService { constructor( private modalCtrl: ModalController ) { } public async openChat(contact: Contact) { const chat = await this.modalCtrl.create({ component: ChatModalPage, animated: true, componentProps: {contact} }); await chat.present(); } public async openProfile(contact: Contact) { const profile = await this.modalCtrl.create({ component: ProfileComponent, animated: true, componentProps: {contact} }); return await profile.present(); }
Chat Modal Page
import { ModalService } from 'src/app/Services/Modal/modal.service'; export class ChatModalPage { constructor( private modalService: ModalService, ) { } public async openProfile() { this.modalService.openProfile(this.contact); } }
client:154 Circular dependency detected:
src/app/Services/Modal/modal.service.ts -> src/Components/chat-modal/chat-modal.page.ts -> src/app/Services/Modal/modal.service.ts
Posts: 9
Participants: 2