Skip to content

sangamprashant/ImgTunnel_CDN-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImgTunnel

ImgTunnel is a secure image CDN system that allows users to upload images and protects access to them. Only authorized domains can access uploaded content.

🔐 Features

  • Secure image upload system via upload.php
  • Protected image serving with domain verification (serve.php)
  • Organized folder structure with separation between public and protected files
  • Environment configuration using .env for sensitive data
  • Simple UI via test.html for image upload testing

📁 Folder Structure


IMAGE\_CDN\_ALL\_IMAGES/
├── uploads/                 # Public images (if needed)
├── uploads\_protected/      # Protected, non-public images
├── .env                    # Environment variables (DB credentials)
├── db.php                  # DB connection using env
├── index.php               # Entry or redirect page (optional)
├── serve.php               # Serves images with domain checks
├── test.html               # Basic frontend for image upload
├── upload.php              # Handles image upload securely

🛠 Setup Instructions

  1. Clone the repository:
git clone https://github.com/yourusername/imgtunnel.git
cd imgtunnel
  1. Setup .env file:

Create a .env file at the root:

DB_HOST=localhost
DB_USER=root
DB_PASSWORD=
DB_NAME=image_cdn
  1. Create MySQL database:

Create a database called image_cdn and a table allowed_domains:

CREATE DATABASE image_cdn;
USE image_cdn;
CREATE TABLE allowed_domains (
    id INT AUTO_INCREMENT PRIMARY KEY,
    domain VARCHAR(255) NOT NULL
);
INSERT INTO allowed_domains (domain) VALUES ('localhost'),('yourdomain.com');
  1. Place the project in your XAMPP htdocs folder:
C:\xampp\htdocs\IMG_CDN_ALL_IMAGES\
  1. Start XAMPP (Apache & MySQL) and visit:
http://localhost/IMAGE_CDN_ALL_IMAGES/test.html

🔒 Domain Protection

Only requests from allowed domains (defined in DB) can access protected images through serve.php.

📷 Upload and Serve Example

Upload: Send a POST request to:

http://localhost/IMAGE_CDN_ALL_IMAGES/upload.php

Access: Use serve.php with query param:

http://localhost/IMAGE_CDN_ALL_IMAGES/serve.php?file=your_image_name.png

If the domain is not allowed, it will return "Access denied".

📃 License

This project is licensed under the MIT License.


Made with 🔐 by ImgTunnel

About

Secure PHP-based image CDN system with domain-level access control and protected file serving.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published