Deploying PictShare
Introduction
PictShare is a multi-lingual, open-source image, video, and text hosting service that allows you to upload and share content through simple URLs. The application supports client-side encryption for sensitive content, image manipulation via URL parameters, and various upload methods including paste from clipboard.
Built with PHP for simplicity and portability, PictShare requires minimal configuration and runs on any standard LAMP/LEMP stack. The application stores files locally and generates unique, shareable URLs for each upload.
Key highlights of PictShare:
- Multi-Format Support: Host images, videos, GIFs, and text
- Client-Side Encryption: Encrypt uploads before they leave your browser
- URL-Based Manipulation: Resize, rotate, and filter images via URL
- No Database Required: File-based storage for simplicity
- Paste Upload: Upload from clipboard instantly
- API Access: Simple API for programmatic uploads
- Duplicate Detection: Detect and reuse duplicate uploads
- Configurable Expiration: Set content to auto-expire
- Multi-Language: Interface available in multiple languages
- ShareX Compatible: Works with ShareX and similar tools
- 100% Open Source: Apache-2.0 licensed
This guide walks through deploying PictShare on Klutch.sh using Docker, configuring storage, and setting up the application for production use.
Why Deploy PictShare on Klutch.sh
Deploying PictShare on Klutch.sh provides several advantages for content hosting:
Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds PictShare without complex orchestration. Push to GitHub and your service deploys automatically.
Persistent Storage: Attach persistent volumes for your uploaded content. Your data survives container restarts and redeployments.
HTTPS by Default: Klutch.sh provides automatic SSL certificates, ensuring secure content uploads and serving.
GitHub Integration: Connect your configuration repository directly from GitHub. Updates trigger automatic redeployments.
Scalable Resources: Allocate CPU and memory based on expected traffic.
Environment Variable Management: Securely store configuration through Klutch.sh’s environment variable system.
Custom Domains: Assign a custom domain to your PictShare instance.
Always-On Availability: Your content host remains accessible 24/7 without managing infrastructure.
Prerequisites
Before deploying PictShare on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your PictShare configuration
- Basic familiarity with Docker and containerization concepts
- (Optional) A custom domain for your PictShare instance
Understanding PictShare Architecture
PictShare is built for simplicity:
PHP Application: Lightweight PHP backend handling uploads and serving.
File-Based Storage: No database required, all data stored as files.
URL Router: URL parameters control image manipulation and access.
Encryption Layer: Client-side encryption for private content.
Preparing Your Repository
To deploy PictShare on Klutch.sh, create a GitHub repository containing your Dockerfile.
Repository Structure
pictshare-deploy/├── Dockerfile├── .dockerignore└── README.mdCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM haschek/pictshare:latest
# Environment variablesENV MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE:-100}ENV URL=${URL}ENV ALLOWED_SUBNET=${ALLOWED_SUBNET:-false}ENV UPLOAD_CODE=${UPLOAD_CODE}ENV UPLOAD_FORM_LOCATION=${UPLOAD_FORM_LOCATION:-/}ENV LOG_UPLOADER=${LOG_UPLOADER:-false}ENV JPEG_COMPRESSION=${JPEG_COMPRESSION:-90}ENV PNG_COMPRESSION=${PNG_COMPRESSION:-6}
EXPOSE 80
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ CMD curl -f http://localhost/ || exit 1Creating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdLICENSE.gitignore*.log.DS_StoreEnvironment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
URL | Yes | - | Base URL of your PictShare instance |
MAX_UPLOAD_SIZE | No | 100 | Maximum upload size in MB |
UPLOAD_CODE | No | - | Required code for uploads (password) |
JPEG_COMPRESSION | No | 90 | JPEG compression quality (1-100) |
PNG_COMPRESSION | No | 6 | PNG compression level (1-9) |
LOG_UPLOADER | No | false | Log uploader IP addresses |
ALLOWED_SUBNET | No | false | Restrict uploads to subnet |
Deploying PictShare on Klutch.sh
Once your repository is prepared, follow these steps to deploy PictShare:
- Select HTTP as the traffic type
- Set the internal port to 80 (PictShare’s default port)
- Detect your Dockerfile automatically
- Build the container image
- Attach the persistent volumes
- Start the PictShare container
- Provision an HTTPS certificate
Push Your Repository to GitHub
Initialize and push your repository:
git initgit add Dockerfile .dockerignoregit commit -m "Initial PictShare deployment configuration"git remote add origin https://github.com/yourusername/pictshare-deploy.gitgit push -u origin mainCreate a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “pictshare” or “content-host”.
Create a New App
Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your PictShare Dockerfile.
Configure HTTP Traffic
In the deployment settings:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
URL | https://your-app-name.klutch.sh |
MAX_UPLOAD_SIZE | 100 (or preferred limit) |
UPLOAD_CODE | Your upload password (optional) |
Attach Persistent Volumes
Add the following volumes for data persistence:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/www/data | 50+ GB | Uploaded content storage |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Access PictShare
Once deployment completes, access your PictShare instance at https://your-app-name.klutch.sh.
Using PictShare
Uploading Content
Upload through the web interface:
- Navigate to your PictShare URL
- Drag and drop or click to select files
- Enter upload code if configured
- Receive shareable URL
URL-Based Image Manipulation
Manipulate images via URL parameters:
- Resize:
/400x300/image.jpg- resize to 400x300 - Thumbnail:
/100x100/image.jpg- create thumbnail - Rotation:
/r90/image.jpg- rotate 90 degrees - Grayscale:
/gray/image.jpg- convert to grayscale - Blur:
/blur/image.jpg- apply blur effect
Combine multiple operations: /400x300/gray/r90/image.jpg
Client-Side Encryption
Use encryption for sensitive content:
- Enable encryption before upload
- Content encrypted in browser
- Share URL includes decryption key
- Only recipients with URL can view
API Uploads
Upload programmatically:
curl -F "file=@image.jpg" https://your-pictshare.klutch.sh/api/uploadWith upload code:
curl -F "file=@image.jpg" -F "uploadcode=yourcode" https://your-pictshare.klutch.sh/api/uploadProduction Best Practices
Security Recommendations
- Upload Code: Set an upload code to prevent anonymous uploads
- HTTPS Only: Always use HTTPS
- Size Limits: Set appropriate upload size limits
- Subnet Restrictions: Limit upload sources if needed
Storage Management
- Monitor Usage: Track storage consumption
- Expiration: Enable content expiration for temporary shares
- Duplicate Detection: Let PictShare reuse duplicates
- Cleanup: Periodically remove old content
Troubleshooting Common Issues
Upload Failures
Symptoms: Files fail to upload.
Solutions:
- Check file size limits
- Verify upload code if configured
- Confirm storage space available
- Review file format support
Images Not Loading
Symptoms: Images return errors.
Solutions:
- Verify URL format
- Check file exists
- Confirm volume mounted correctly
- Review PHP error logs
Additional Resources
- PictShare GitHub Repository
- PictShare Official Website
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
Conclusion
Deploying PictShare on Klutch.sh gives you a versatile content hosting service with automatic builds, persistent storage, and secure HTTPS access. The combination of simple uploads, URL-based manipulation, and client-side encryption makes PictShare flexible for various hosting needs.
Whether you’re sharing screenshots, hosting images for documentation, or need encrypted content sharing, PictShare on Klutch.sh provides the foundation for reliable, self-hosted content hosting.