Skip to content

sulimu2/base64-to-gif-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base64 to GIF Converter

A web application that converts Base64 encoded strings to animated GIFs. Works on both desktop and mobile browsers, and can be deployed to a server.

Features

  • Convert Base64 strings to animated GIFs directly in the browser
  • Responsive design that works on both desktop and mobile devices
  • Upload Base64 data from a text file
  • Download converted GIFs
  • Server version for deployment
  • Database storage for conversion history

Setup

  1. Install the required dependencies:

    pip install -r requirements.txt
    
  2. Create your own configuration file:

    • Copy config.py.example to config.py
    • Update the database configuration in config.py with your MySQL credentials
  3. Run the server:

    python server.py
    
  4. Open your browser and go to http://localhost:5000

Usage (Web Version)

  1. Open index.html in your browser
  2. Paste your Base64 string into the text area or upload a file containing Base64 data
  3. Click "Convert to GIF"
  4. View the converted GIF and download it if needed

Usage (Server Version)

  1. Install the required dependencies:

    pip install -r requirements.txt
    
  2. Create your own configuration file:

    • Copy config.py.example to config.py
    • Update the database configuration in config.py with your MySQL credentials
  3. Run the server:

    python server.py
    
  4. Open your browser and go to http://localhost:5000

Deployment

To deploy this application to a server:

  1. Copy all files to your server

  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Create your own configuration file:

    • Copy config.py.example to config.py
    • Update the database configuration in config.py with your MySQL credentials
  4. Run the server:

    python server.py
    
  5. Configure your web server (nginx, Apache, etc.) to proxy requests to the Flask application

API Endpoints

The server provides API endpoints for Base64 to GIF conversion:

Convert Base64 to GIF

  • URL: /api/convert
  • Method: POST
  • Data:
    {
      "base64": "base64_encoded_string"
    }
  • Response:
    {
      "success": true,
      "gif_data": "base64_encoded_gif_data"
    }

Get Conversion History

  • URL: /api/history
  • Method: GET
  • Response:
    {
      "success": true,
      "history": [
        {
          "id": 1,
          "created_at": "2023-06-01T10:00:00.000Z"
        }
      ]
    }

Database Schema

The application uses a MySQL database with the following schema:

CREATE TABLE conversions (
    id INT AUTO_INCREMENT PRIMARY KEY,
    base64_data LONGTEXT NOT NULL,
    gif_data LONGBLOB NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published