cordova-plugin-camera 1.2.0 “Camera” This is the new installed.
Ok, a few things.
- What version of Android are you on? Have you tried it on earlier versions?
- Can you display the image in your app when it comes back from the gallery with the returned URI?
- What is the full URI that is returned? Show me what it returns from a new image vs a gallery image.
- How about your php script? Share it if you can.
- How are you building your app? Ionic CLI? ionic build android?
Robert
- I’m going to try other versions of Android.
- If you can view the image after bring.
- The full URI is content: //com.android.providers.media.documents/document/image%3A43
if(isset($_FILES['file'])){
$nombre_archivo = $_FILES['file']['tmp_name'];
$porcentaje = 0.5;
header('Content-Type: image/jpeg');
list($ancho, $alto) = getimagesize($nombre_archivo);
$nuevo_ancho = $ancho * $porcentaje;
$nuevo_alto = $alto * $porcentaje;
$imagen_p = imagecreatetruecolor($nuevo_ancho, $nuevo_alto);
$imagen = imagecreatefromjpeg($nombre_archivo);
imagecopyresampled($imagen_p, $imagen, 0, 0, 0, 0, $nuevo_ancho, $nuevo_alto, $ancho, $alto);
if(imagejpeg($imagen_p, $destino)){
$save['image'] = $imageName;
}
}
- Yes, ionic build android
@rgecy up! I found news on Android versions, but I could not fix it.
Tip: you need a function in your .js, you need to install the plugin in your apps root directory, add a onclick action to trigger the function from the .js page the .js page will fire the process to the .php page.
Here’s the only decent web developer to php tutorial I could find to help me.
You’re going to also need a remote allow origin in your servers .php page.
Remember, add the camera, file and file-transfer plugins to your root directory.
Good luck. Happy coding.
Hi sioesi did u find any solution for that if u found any solution please share the code…
Thanks in Advance…
hope this help you:
// Destination URL
var url = "http://api/upload.php";
//File for Upload
var targetPath = imagePath;
// File name only
var filename = "profile.jpg";
console.log(filename);
var options = {
fileKey: "file",
fileName: filename,
chunkedMode: false,
mimeType: "image/jpeg",
params : {'directory':location, 'fileName':filename}
};
var ft = new FileTransfer();
ft.upload(targetPath, encodeURI(url), win, fail, options);
function win(result) {
console.log("SUCCESS: " + JSON.stringify(result.response));
$ionicLoading.hide();
}
function fail(error) {
console.log("ERROR: " + JSON.stringify(error));
$ionicLoading.hide();
}
just search for renaming the image name… for me profile.jpg is okay…