Cloud Storage Integration

At this stage, cloud storage is added to the plugin. However, in order to use it, you can follow the instruction or create your own scripts. If you can to customize it, please refer to the Developer section.

Enable Cloud Storage

In general tab, you have add the Storage Bucket from your firebase project, then check the option for Storage under Firebase Services.

../_images/enable-cloud-storage.png

Configure Cloud Storage

Upload File to Cloud Storage

Upload files to Cloud Storage is similar to Save Data to Firestore Database.

First, we need to create a form with the help of Contact Form 7 or you can design your own custom form if you want.

// This form will create a path of the file to "users" collection
// If you want to generate a random id, you can leave out the documentId
// The file will be uploaded to "wpImages/documentId/timestamp+filename" path under Storage

[hidden collectionName "users"]
[hidden documentId "some-random-id"]
[hidden databaseType "firestore"]
[hidden fileType "imageUrl"]

[file imageUrl limit:1mb filetypes:gif|png|jpg|jpeg]

[submit "Upload File"]

Please refer to the Contact Form 7 for configuring your file input.

After submiting the file, it will be uploaded to Cloud Storage under wpImages/som-random-id path. The image name will be prefixed with a timestamp.

../_images/storage-images-path.png

Image Path in Storage

../_images/file-record-firestore.png

Image Path in Firestore