I would like to use under ionic 4 "fast-exif".
https://github.com/titarenko/fast-exif
And I don't arrive to make it works
var exif = require('fast-exif');
doesn't work under ionic 4
Edited to show the code:
const exif = require('fast-exif');
const img = files[0];
exif.read(img).then(console.log).catch(console.error);
Someone can help me with this?
Thanks
Related
I try to simply integrate the image picker in my Tab Page. I have a ion-button which calls the Method chooseImage() on a click.
The Problem ist, that when I start the app in the iOS Simulator, it starts normal, but when I click on the chooseImage Button it crashes in that moment. The Image Picker does not open, it crashes before, directly at the click on the button.... I don't know why. Maybe someone could help me please!
This is the Method:
chooseImage() {
this.options = {
width: 220,
quality: 32,
outputType: 1,
maximumImagesCount: 5
};
this.imageObj = [];
this.imagePicker.getPictures(this.options).then((res) => {
for (var i = 0; i < res.length; i++) {
this.imageObj.push('data:image/jpeg;base64,' + res[i]);
}
}, (error) => {
alert(error);
});
}
Probably you miss NSPhotoLibraryUsageDescription in your Info.plist. You should add this:
<key>NSPhotoLibraryUsageDescription</key>
<string>Some description</string>
Where and how add these lines?
This will be helpful if you use cordova: Add entry to iOS .plist file via Cordova config.xml
If you use capacitor check documentation.
When I focus input box, the cursor displayed in the wrong place.
It's built using Ionic 1.
Why?
Thank you
I used this at first
<ion-content class="side-menu">
But someone reported that they couldn't see what they are typing in inputbox.
Inputbox is hidden under the keyboard and the cursor displays in the wrong place.
Actually it worked will on Samsung Galaxy S3.
But to fix that issue(not on Samsung Galaxy S3, even it worked well on my iPhone), I added this.
<ion-content class="side-menu" delegate-handle="mainScroll" overflow-scroll="false">
After add above code, there was issue on Samsung Galaxy too.
So I removed this code again.
delegate-handle="mainScroll" overflow-scroll="false"
Could you please let me know how we can make sure it works on the other iPhone device too?
maybe iPhone 8
<input type="text" id="places" ng-focus="scrollTo('places')" />
$scope.scrollTo = function (elementId) {
$timeout(function() {
var elem = document.getElementById(elementId);
var yOffset = elem.offsetTop;
var elementHeight = elem.offsetHeight;
var scrollPoint = yOffset + elementHeight - 100;
console.log(yOffset, scrollPoint);
$ionicScrollDelegate.$getByHandle('mainScroll').scrollTo(0, scrollPoint, true);
//$ionicScrollDelegate.scrollTo(0, scrollPoint, true);
var quotePosition = $ionicPosition.position(angular.element(elem));
console.log(quotePosition);
//$ionicScrollDelegate.$getByHandle('mainScroll').scrollTo(0, quotePosition, true);
}, 200);
};
scrollTo is not working well.
i am trying to add facebook share dialog into my ios application and i found the official page from facebook on how to do it, but i run into a problem about ContentProtocol. i dont know what that is. here is the link to the guidence that i use . it is pretty straight forward. basically just install the pod facebookshare, import it and add few line of code, but i got problem on 'myContent'
here is the code
import FacebookShare
let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .Native
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
// Handle share results
}
try shareDialog.show()
here is the link
https://developers.facebook.com/docs/swift/sharing/share-dialog
what should i put in the myContent?
I guess next link is explained what you can use as content and how to use it
Content-types
(From documentation) Currently, the Facebook SDK for Swift can share 4 different kinds of content:
Links - Represented by the LinkShareContent object.
Photos - Represented by the PhotoShareContent object.
Videos - Represented by the VideoShareContent object.
Open Graph - Represented by the OpenGraphShareContent object.
you can use FBSDKShareLinkContent
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "//URL")
content.contentTitle = "MyApp"
content.contentDescription = "//Desc"
content.imageURL = NSURL(string:"//Image URL")
I have the following code and is working for me but it can only currently show artist and song :
let mpic = MPNowPlayingInfoCenter.defaultCenter()
mpic.nowPlayingInfo = [MPMediaItemPropertyTitle:songs[currentAudioIndex].songName,
MPMediaItemPropertyArtist:songs[currentAudioIndex].artistName]
I tried also setting the picture with the following code but it isn't working :
mpic.nowPlayingInfo = [MPMediaItemPropertyTitle:songs[currentAudioIndex].songName,
MPMediaItemPropertyArtist:songs[currentAudioIndex].artistName,
MPMediaItemPropertyArtwork:songs[currentAudioIndex].songImage]
SongImage is of type UIImage.
Never mind I figured out.
If anyone want to learn you have to
do the following
let mpic = MPNowPlayingInfoCenter.defaultCenter()
// initialize an instance of MPMediaItemArtWork with a UIImage
var albumArtWork = MPMediaItemArtwork(image: songs[currentAudioIndex].songImage)
// Then assign it to the MPNowPlayingInfoCenter
mpic.nowPlayingInfo = [
MPMediaItemPropertyTitle:songs[currentAudioIndex].songName,
MPMediaItemPropertyArtist:songs[currentAudioIndex].artistName,
MPMediaItemPropertyArtwork:albumArtWork
]
Hope this helps anyone who is also struggling with this.
Thanks
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = [MPMediaItemPropertyArtist : AudioCenter.sharedInstnce.currentReciter().name,
MPMediaItemPropertyTitle : AudioCenter.sharedInstnce.currentSurah()!.name,
MPMediaItemPropertyArtwork:MPMediaItemArtwork(image: UIImage(named: "Logo")!)]
How can I retrieve the path of an image stored in my album in an iPhone using Flex mobile? same with an image being taken with the camera on the iPhone.
for Android I use this function and it works, but for the iPhone, it doesn't any ideas?
protected function onMediaSelect(event:MediaEvent):void
{
var mp:MediaPromise = event.data;
image.source = mp.file.url;
}
and this I use for when I'm taking th picture ont he spot
protected function onComplete(evt:MediaEvent):void
{
img.source = evt.data.file.url;
}
if you can show me in the right direction I greatly appreciate it. thanks!
~Myy
image.source = File.desktopDirectory.resolvePath(file_name).url;
this one it will work only under windows...
image.source = File.desktopDirectory.resolvePath(file_name).nativePath;
the source property of Image passing a filename that start with / (/ is root for unix based OS, android, linux, ios, etc), will take is as a relative path instead of complete path...
I ad to use the cameraroll class
//if we get the image
trace( "Asynchronous media promise." );
var eventSource:IEventDispatcher = dataSource as IEventDispatcher;
eventSource.addEventListener( Event.COMPLETE, onMediaLoaded );