Solved {Select image from iOS photo library}How can i open the photo library and have the user select an image and process/upload it?
-
This is all my current code but it launches the files app on iOS, i want it to run the photo library:
CODE:
bool BackEnd::prepareImage(QUrl path)
{
QFile *file;#ifdef Q_OS_ANDROID file = new QFile(QQmlFile::urlToLocalFileOrQrc(path)); #else file = new QFile(path.toLocalFile()); #endif file->open(QIODevice::ReadOnly); QByteArray image = file->readAll(); QString encoded = image.toBase64(); file->close(); if (encoded.size() < 12000000) { imageToUploadBase64 = encoded; return true; } else return false;
}
void BackEnd::cancelImage()
{
imageToUploadBase64 = "";
} -
Its for an android port to ios
-
@LoudestBoi Use QStandardPaths::PicturesLocation to get the pictures location via https://doc.qt.io/qt-5/qstandardpaths.html#standardLocations Then you can read files there.
I think you also have to request access rights via Info.plist. -
@LoudestBoi take a look at this topic and the example code by @benlau
https://forum.qt.io/topic/75700/ios-photo-gallery-view-in-qt/7
should get you started/contain all you need
-
This post is deleted!