hi ,
when i upload image with input text .
input text only send to database
code add.ts
let postData = {
"username": this.username,
"fullname": this.fullname,
"cat": this.cat,
"country": this.country,
"sex": this.sex,
"image": this.imageData,
}
let data:Observable<any> = this.http.post(this.url+/api/addsnap',postData );
data.subscribe((res) => {
console.log(res);
});
code select
takePicture(sourceType) {
const options: CameraOptions = {
quality: 50,
sourceType: sourceType,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
}
this.camera.getPicture(options).then((imageData) => {
this.imageData = 'data:image/jpeg;base64,' + imageData;
this.correctPath = imageData.substr( imageData.lastIndexOf('/') + 1);
console.log("imageData"+this.correctPath);
}, (err) => {
// Handle error
});
php code inster image
if($request->file('image')) {
$file = $request->file('image');
$timestamp = 21;
$name = $timestamp. '-' .$file->getClientOriginalName();
$n = Image::make($file);
$n->resize(330, 330);
$path = 'uploads/'.$name;
$n->save($path);
$Members->photo = $name;
}