Init Image Converter
======================

A lightweight, self-hosted PHP tool for batch converting and resizing images
directly on your own server. Designed for developers who prefer full control
over their data — no external storage, APIs, or third-party services required.
Upload multiple images, process them instantly, and download results
individually or as a ZIP archive.

----------------------------------------------------------------------
FEATURES
----------------------------------------------------------------------

- 100% self-hosted — all files stay on your own server.
- Batch upload & batch processing.
- Convert between JPG, PNG, GIF, and WebP.
- Optional resizing by maximum width.
- Adjustable quality for JPG & WebP output.
- Automatic unique file naming.
- Image preview after processing.
- Download each file individually.
- One-click “Download all as ZIP”.
- Secure cleanup tool for /uploads directory.
- Simple login authentication (username/password).
- CSRF protection for all critical actions.
- Login rate limiting for brute-force protection.
- LocalStorage integration to remember last-used settings.

----------------------------------------------------------------------
CONFIGURATION
----------------------------------------------------------------------

Edit the CONFIG section at the top of `init-image-converter.php`:

define('USERNAME', 'admin');
define('PASSWORD', 'Admin@123');  // Supports both plain text and password_hash

Authentication notes:

- The PASSWORD value supports two formats:
  1. Plain text
  2. A hashed string generated by PHP password_hash()
- The script automatically detects whether PASSWORD is a hashed value.
- If it is a valid password_hash, login uses password_verify().
- If it is plain text, login uses a secure comparison (hash_equals).

Example of using a hashed password:

  define('PASSWORD', '$2y$10$XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

To generate a password hash, run:

  echo password_hash('YourPassword', PASSWORD_DEFAULT);

System requirements:
- PHP >= 7.4 (PHP 8+ recommended)
- Extensions:
  - gd (image processing)
  - fileinfo (MIME detection)
  - zip (for “Download all as ZIP”)
- Write permission for /uploads directory

----------------------------------------------------------------------
USAGE
----------------------------------------------------------------------

1. Place `init-image-converter.php` on a PHP-enabled server.
2. Visit the script in your browser.
3. Log in using the configured username and password.
4. Select one or multiple images to upload.
5. Choose:
   - Output format (keep original / JPG / PNG / WebP)
   - Max image width for resizing
   - Compression quality (1–100)
6. Click “Process files”.
7. Preview processed images directly in the browser.
8. Download each file individually or use “Download all as ZIP”.

----------------------------------------------------------------------
NOTES
----------------------------------------------------------------------

- The tool runs entirely on your own server — no remote APIs, no cloud.
- Ideal for developers, bloggers, and self-hosted workflows.
- Supports JPG, PNG, GIF, and WebP input files.
- Animated GIF is currently treated as static (animation not preserved).
- If WebP is selected, all output images will be saved as .webp.
- Use HTTPS to protect login credentials.
- The /uploads directory is auto-created if it does not exist.
- Cleanup permanently deletes all files inside /uploads.

----------------------------------------------------------------------
CREDIT
----------------------------------------------------------------------

© Init HTML  
https://inithtml.com
