Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 2.01 KB

README.md

File metadata and controls

68 lines (48 loc) · 2.01 KB

ImgDir

Convenient Image Directory


Features

  • Auto-Generated Image Sizing
  • Caching (and Auto-Recache on Original Modification)
  • Admin Area
  • PNG, JPG, GIF

Requirements

  • Apache (with Rewrite)
  • PHP 5.4+
  • PHP GD Library

Notes

  • Change the ADMIN_PASSWORD in config.php
  • You can upload images manually to the originals folder
  • GIF animations are not retained after resizing

Image Modifiers (GET Params):

  • w = width

    • auto-calculated at ratio if only h is provided
  • h = height

    • auto-calculated at ratio if only w is provided
  • r = resize type

    • only necessary when both w and h supplied
    • f (fit) (default)
      • fits the entire image into the size
    • c (crop)
      • center-crops the image
  • b = background

    • pass hex color (e.g., ff23ba) (default is white for jpg, transparent for png)
      • only applies with fit (r=f)
  • debug = debug mode

    • if is set, will always recache and display text (instead of fallback images) on failure
  • Program attempts to gracefully fail and display an image if possible

  • Displays assets/default.png as fallback

Examples:

  • /__test_landscape.png?w=300

    • resizes image to 300px wide, keeping the aspect ratio
  • /__test_landscape.png?w=300&h=300

    • resizes image to 300px wide and 300px tall, fitting the aspect ratio with a white background fill
  • /__test_landscape.png?w=300&h=300&r=f&b=000000

    • resizes image to 300px wide and 300px tall, fitting the aspect ratio with a black background fill
  • /__test_landscape.png?w=80&h=80&r=c

    • resizes image to 80px wide and 80px tall, center-cropping the contents

Admin Screenshots:

ImgDir Admin Dashboard

ImgDir Admin View

ImgDir Admin Upload 1

ImgDir Admin Upload 2