Skip to content

kingnigma/convertify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Convertify v1.0

A lightweight, self-hosted image conversion web application built with PHP and vanilla JavaScript. Convert images between popular formats directly in your browser.

Features

  • 🎨 Image Format Conversion: PNG, JPG, GIF, WEBP, BMP
  • πŸ–±οΈ Drag & Drop Interface: Easy file upload with visual feedback
  • πŸ“Š Real-time Progress: Upload progress tracking per file
  • πŸ”„ Batch Conversion: Convert multiple files at once
  • πŸ“¦ Bulk Download: Download all converted files as ZIP
  • 🎯 Per-file Format Selection: Choose different output formats for each file
  • πŸ”’ Secure: File validation, unique filenames, temporary storage
  • πŸ’¨ No Dependencies: Pure PHP with GD extension

Supported Formats

Input Output
PNG, JPG, GIF, WEBP, BMP PNG, JPG, GIF, WEBP, BMP

Requirements

  • PHP 7.2 or higher
  • PHP GD extension (enabled by default in most installations)
  • Apache/Nginx web server
  • 256MB memory limit (recommended)

Installation

Localhost Setup (XAMPP/WAMP)

  1. Download and extract the project to your webroot:

    C:\xampp\htdocs\convertify\
    
  2. Verify PHP GD extension is enabled:

    • Open php.ini (XAMPP: C:\xampp\php\php.ini)
    • Ensure this line is uncommented:
      extension=gd
    • Restart Apache
  3. Create outputs directory (if not exists):

    mkdir outputs
    chmod 755 outputs
  4. Access the application:

    http://localhost/convertify
    
  5. Test the setup:

    • Visit http://localhost/convertify/debug.php to verify configuration

Live Server Setup (Linux/cPanel)

Via cPanel File Manager

  1. Upload files to your domain directory (e.g., /public_html/convertify/)

  2. Set permissions:

    • outputs/ folder: 755 or 777
    • .htaccess files: 644
  3. Verify PHP version in cPanel β†’ Select PHP Version (7.2+)

  4. Enable GD extension in cPanel β†’ Select PHP Version β†’ Extensions β†’ Check gd

  5. Test: Visit https://yourdomain.com/convertify/debug.php

Via SSH/Terminal

# Navigate to web directory
cd /var/www/html

# Clone or upload project
git clone https://github.com/kingnigma/convertify.git
cd convertify

# Set permissions
chmod 755 outputs
chmod 644 .htaccess

# Verify PHP and GD
php -v
php -m | grep gd

# Restart web server (if needed)
sudo systemctl restart apache2
# or
sudo systemctl restart nginx

Nginx Configuration (if applicable)

Add to your server block:

location /convertify {
    try_files $uri $uri/ /convertify/index.php?$query_string;
}

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Configuration

Upload Limits

Edit .htaccess to adjust limits:

php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value memory_limit 256M
php_value max_execution_time 120

File Cleanup

Converted files are stored in outputs/. To auto-cleanup old files:

Linux (cron):

# Edit crontab
crontab -e

# Add cleanup job (runs every 30 minutes)
*/30 * * * * find /path/to/convertify/outputs -type f -mmin +30 -delete

Windows (Task Scheduler):

  • Create task to run every 30 minutes
  • Action: forfiles /p "C:\xampp\htdocs\convertify\outputs" /m *.* /d -1 /c "cmd /c del @path"

Usage

Web Interface

  1. Upload Files:

    • Click the dropzone or drag & drop files
    • Supports multiple files (max 10MB each)
  2. Select Output Format:

    • Choose format for each file individually
    • Or use "Apply to all" for batch conversion
  3. Convert:

    • Click "Convert Now"
    • Watch real-time upload progress
    • Download individual files or all as ZIP

API Endpoint

POST convert.php

curl -F "image=@input.png" -F "to=jpg" \
  http://localhost/convertify/convert.php

Response:

{
  "success": true,
  "url": "outputs/filename_abc123.jpg",
  "filename": "filename_abc123.jpg"
}

Error Response:

{
  "success": false,
  "error": "Unsupported file type"
}

Project Structure

convertify/
β”œβ”€β”€ index.php           # Main UI
β”œβ”€β”€ convert.php         # Conversion API endpoint
β”œβ”€β”€ debug.php           # Server diagnostics
β”œβ”€β”€ .htaccess           # Apache configuration
β”œβ”€β”€ README.md           # Documentation
β”œβ”€β”€ outputs/            # Converted files (auto-created)
β”‚   └── .htaccess       # Security rules
└── assets/
    └── img/
        └── logo.png    # Application logo

Troubleshooting

"Unexpected end of JSON input"

  • Cause: PHP errors before JSON output
  • Fix: Check error.log in project root, verify GD extension is enabled

"Outputs directory not writable"

  • Cause: Insufficient permissions
  • Fix: chmod 755 outputs or chmod 777 outputs

"GD extension not loaded"

  • Cause: GD not enabled in PHP
  • Fix: Enable in php.ini and restart web server

"File upload error"

  • Cause: File too large or upload limits
  • Fix: Increase limits in .htaccess or php.ini

BMP/WEBP not working

  • Cause: PHP version < 7.2 (BMP) or GD compiled without WEBP
  • Fix: Update PHP or recompile GD with WEBP support

Security Notes

  • βœ… MIME type validation
  • βœ… File extension whitelist
  • βœ… Unique output filenames
  • βœ… Directory listing disabled
  • βœ… PHP execution blocked in outputs/
  • ⚠️ No authentication (add if exposing publicly)
  • ⚠️ No rate limiting (implement for production)
  • ⚠️ Files stored temporarily (implement cleanup)

Version 2.0 Roadmap

Planned Features

🎬 Video Conversion (via FFmpeg)

  • MP4, MOV, AVI, WEBM
  • Resolution/bitrate control
  • Video compression

🎡 Audio Conversion (via FFmpeg)

  • MP3, M4A, WAV, OGG, FLAC
  • Bitrate adjustment
  • Audio normalization

πŸ“„ Document Conversion (via LibreOffice)

  • DOCX/DOC β†’ PDF
  • XLSX/XLS β†’ PDF
  • PPTX/PPT β†’ PDF
  • RTF β†’ PDF

🎨 SVG Support (via ImageMagick)

  • SVG β†’ PNG/JPG
  • Raster β†’ SVG (tracing)

⚑ Performance Improvements

  • Queue system for large files
  • Background processing
  • Server-side ZIP generation

πŸ” Security Enhancements

  • User authentication
  • API rate limiting
  • File encryption at rest

πŸ“Š Advanced Features

  • Image editing (crop, resize, rotate)
  • Batch operations
  • Conversion history
  • Cloud storage integration

v2.0 Requirements

  • FFmpeg (video/audio)
  • LibreOffice (documents)
  • ImageMagick (SVG)
  • Redis/Database (queue system)

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

License

MIT License - feel free to use in personal and commercial projects.

Author

Mathew Kings

Support


Star ⭐ this repo if you find it useful!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published