简体   繁体   English

我卡在 firebase 云火库上的上传图像中。 谁能帮我。?

[英]i m stuck in upload image on firebase cloud firestore. Can anyone help me .?

const { user_id, username } = this.props;
const { imagePath } = this.state;

const fileExtension = imagePath.split(".").pop();
console.log("EXT: " + fileExtension);

var uuid = uuidv4();

const fileName = `${uuid}.${fileExtension}`;
console.log("fiile name ---> " + fileName);

this.setState({ profile_image : fileName });

And

export const addManualContact = 
    (username, profile_image ) => {
         firebase.firestore().collection('user').doc(`${username}`).collection('contacts').add({ profile_image: profile_image }) }

The problem was my library import ImagePicker from "react-native-image-crop-picker";问题是我的库import ImagePicker from "react-native-image-crop-picker";

Here is function:这是 function:

//Here is take photo from gallery 
 takePhotoFromCamera2 = () => {
    ImagePicker.openCamera({
      width: 300,
      height: 400,
      cropping: true,
    }).then((image2) => {
      this.setState({ profile_image2: image.path });
      console.log(image2);
      this.setState({
        image2: {
          uri: image2.path,
          width: image2.width,
          height: image2.height,
          mime: image2.mime,
        },
        images: null,
      });
    });
  };

and I upload the image in Firestore like this:我像这样在 Firestore 中上传图像:

firebase.firestore()
        .collection("user")
        .doc(`${username}`)
        .update({ profile_image: profile_image });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试上传图片,但图片没有添加到云 Firestore,它上传到了 Firebase 存储但没有显示在 React 应用程序中 - I'm trying to upload image but image is not adding to cloud firestore, its uploaded on firebase storage But not showing in React app 嘿,任何人都可以帮助我完成我正在尝试构建的这个注册网站项目 - hey can anyone help me with this sign up website project I'm trying to build 我被一个java脚本问题困住了。 你能帮我吗? - I'm stuck with a java-script question. Can you help me out? 谁能帮我上传 PHP 块上传的 JS 代码 - Can anyone help me with the JS code for PHP chunk upload 我尝试创建一个图像弹出窗口但在这里我的脚本严重失败任何人都可以帮助我 - I tried creating a image popup but failed badly here my script anyone can help me out 任何人都可以通过Twitter帮助我吗? - Can anyone help me with Twitter? 学习 OOP Javascript,我真的很努力,但它并没有陷入困境。谁能帮我解决这个问题? - Learning OOP Javascript, I'm trying really hard, but it isn't sinking in. Can anyone help me with this problem? 我有一个要搜索Cloud Firestore的运动(数组)列表。 但是,数组大小会有所不同 - I have a list of sports (array) I want to search Cloud Firestore. However, the array will differ in size 有人可以帮我简化吗? - Can anyone help me simplify? 我正在尝试在 firebase 数据库上推送数据,但我收到此错误“无法读取属性“推送””,谁能告诉我我做错了什么? - I'm trying to push data on firebase database but I'm getting this error 'Cannot read property "push" ', can anyone tell me what I'm doing wrong?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM