Skip to content

A Flask-based web application for storing and managing images using Firebase Authentication, Firestore database, and Google Cloud Storage.

Notifications You must be signed in to change notification settings

heyabhiraj/GalleryApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Storage Service

A Flask-based web application for storing and managing images using Firebase Authentication, Firestore database, and Google Cloud Storage.

Features

  • User Authentication: Simple email-based login/signup
  • Gallery Management: Create, rename, delete galleries
  • Image Upload: Upload JPG, JPEG, PNG images
  • Image Management: View, delete images
  • Gallery Sharing: Share galleries with other users by email
  • Duplicate Detection: Prevents uploading the same image twice
  • Responsive Design: Works on desktop and mobile devices

Setup Instructions

1. Prerequisites

  • Python 3.7+
  • Google Cloud Project with Firebase enabled
  • Firebase service account key

2. Virtual Environment Setup

The virtual environment is already configured. To activate it:

# Navigate to project directory
cd "c:\Users\abhic\Downloads\image_storage_service"

# Activate virtual environment
.\venv\Scripts\Activate.ps1

3. Firebase Configuration

  1. Go to Firebase Console
  2. Select your project: image-storage-service-466107
  3. Go to Project Settings > Service Accounts
  4. Generate a new private key
  5. Download the JSON file and rename it to serviceAccountKey.json
  6. Place it in the project root directory

4. Google Cloud Storage

Make sure your Firebase project has Storage enabled:

  1. Go to Firebase Console > Storage
  2. Get started and set up Cloud Storage
  3. Your bucket name should be: image-storage-service-466107.appspot.com

5. Running the Application

# Make sure virtual environment is activated
python main.py

The application will start on http://127.0.0.1:8080

Project Structure

image_storage_service/
├── main.py                 # Main Flask application
├── requirements.txt        # Python dependencies
├── app.yaml               # Google App Engine config
├── serviceAccountKey.json # Firebase credentials (you need to add this)
├── venv/                  # Virtual environment
├── templates/             # HTML templates
│   ├── login.html
│   ├── dashboard.html
│   └── gallery.html
└── static/               # Static files (CSS, images)
    └── style.css

Usage

Login/Signup

  • Enter any email address
  • If the user exists in Firebase, you'll be logged in
  • If not, a new user will be created automatically

Managing Galleries

  • Create new galleries from the dashboard
  • Rename galleries from the gallery page
  • Delete galleries (this also deletes all images)
  • Share galleries with other users by email

Managing Images

  • Upload images (JPG, JPEG, PNG only)
  • View all images in a gallery
  • Delete individual images
  • Duplicate detection prevents uploading the same image twice

Important Notes

Security

  • Change the app.secret_key in production
  • The current authentication is simplified for demo purposes
  • In production, implement proper password authentication

Firebase Rules

Make sure your Firestore security rules allow authenticated users to read/write their own data:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

Storage Rules

Configure Cloud Storage rules to allow authenticated uploads:

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth != null;
    }
  }
}

Troubleshooting

Common Issues

  1. ModuleNotFoundError: Make sure virtual environment is activated
  2. Firebase Credentials Error: Ensure serviceAccountKey.json is in the project root
  3. Storage Bucket Not Found: Verify bucket name in main.py matches your Firebase project
  4. Permission Denied: Check Firebase security rules

Error Messages

The application provides helpful error messages through flash notifications for common issues like:

  • Invalid file formats
  • Duplicate images
  • Permission errors
  • Authentication failures

Development

To modify the application:

  1. Edit main.py for backend logic
  2. Edit templates in templates/ for frontend
  3. Edit static/style.css for styling
  4. Test changes locally before deploying

Deployment

This application is configured for Google App Engine deployment using the included app.yaml file.

About

A Flask-based web application for storing and managing images using Firebase Authentication, Firestore database, and Google Cloud Storage.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published