My project deals with Business, their products and customers. Every business, product and customer (user) has its unique ID. In my cloud storage, I have around 30 images. Image size is around ~60/70KB. Even if I take 100KB each, the total is just 3MB.
The project is still in development, I'm keeping these images for testing purpose. I'm not updating any new image but my byte storage keeps rising. I even deleted some images but it keeps increasing. I don't understand and I couldn't find the answer. Someone, please explain.
As you can see here in the image, the byte stored is almost 5GB. When I manually calculate all the images, it's not even 3MB.
Here is the hierarchy of my cloud storage.
- Whenever a customer upload/update their profile picture, that image will be saved here in this "UserProfile" collection and the name of the image will be the user ID.
UserProfile (Collection)
- user_1.jpeg
- user_2.jpeg
-
-
- user_n.jpeg
- Business can have many profile images. Those images will be store under "BusinessProfile\{business_id}\..."
BusinessProfile (Collection)
- Business_1 (Sub-Collection)
- businessImage1.jpeg
- businessImage2.jpeg
-
-
- businessImageN.jpeg
- Business_2
-
-
- Business_n
- A product can also have many product images. Those will be store under "ProductImage\{business_id_which_the_product_belongs}\{product_id}\..."
ProductImage (Collection)
- Business_1 (Sub-Collection)
- Product_1 (Sub-Collection)
- productImage1.jpeg
- productImage2.jpeg
-
-
- productImagen.jpeg
- Product_2
-
-
- Product_N
- Business_2
-
-
- Business_3
Usually, in other people's design, they'll keep like 3 collections only to store the images and store the image URLs to the document of the user or business or product. The reason why I have this structure with sub-collections is that this way whenever I need the image in the App, I can generate the URL of the image from the ID without retrieving the document data (Just trying to optimize no. of Firebase doc reads).