Skip to content

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.md

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM haschek/pictshare:latest
# Environment variables
ENV 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 check
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD curl -f http://localhost/ || exit 1

Creating the .dockerignore File

Create a .dockerignore file:

.git
.github
*.md
LICENSE
.gitignore
*.log
.DS_Store

Environment Variables Reference

VariableRequiredDefaultDescription
URLYes-Base URL of your PictShare instance
MAX_UPLOAD_SIZENo100Maximum upload size in MB
UPLOAD_CODENo-Required code for uploads (password)
JPEG_COMPRESSIONNo90JPEG compression quality (1-100)
PNG_COMPRESSIONNo6PNG compression level (1-9)
LOG_UPLOADERNofalseLog uploader IP addresses
ALLOWED_SUBNETNofalseRestrict uploads to subnet

Deploying PictShare on Klutch.sh

Once your repository is prepared, follow these steps to deploy PictShare:

    Push Your Repository to GitHub

    Initialize and push your repository:

    Terminal window
    git init
    git add Dockerfile .dockerignore
    git commit -m "Initial PictShare deployment configuration"
    git remote add origin https://github.com/yourusername/pictshare-deploy.git
    git push -u origin main

    Create 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:

    • Select HTTP as the traffic type
    • Set the internal port to 80 (PictShare’s default port)

    Set Environment Variables

    Add the following environment variables:

    VariableValue
    URLhttps://your-app-name.klutch.sh
    MAX_UPLOAD_SIZE100 (or preferred limit)
    UPLOAD_CODEYour upload password (optional)

    Attach Persistent Volumes

    Add the following volumes for data persistence:

    Mount PathRecommended SizePurpose
    /var/www/data50+ GBUploaded content storage

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Detect your Dockerfile automatically
    • Build the container image
    • Attach the persistent volumes
    • Start the PictShare container
    • Provision an HTTPS certificate

    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:

  1. Navigate to your PictShare URL
  2. Drag and drop or click to select files
  3. Enter upload code if configured
  4. 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:

  1. Enable encryption before upload
  2. Content encrypted in browser
  3. Share URL includes decryption key
  4. Only recipients with URL can view

API Uploads

Upload programmatically:

Terminal window
curl -F "file=@image.jpg" https://your-pictshare.klutch.sh/api/upload

With upload code:

Terminal window
curl -F "file=@image.jpg" -F "uploadcode=yourcode" https://your-pictshare.klutch.sh/api/upload

Production 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

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.