Skip to content

v0.2.0

Choose a tag to compare

@arashsaffari arashsaffari released this 20 Feb 02:03
· 23 commits to main since this release

Added

  • Optional package configuration (config/image-optimizer.php) with defaults for:
    • driver selection
    • output directory
    • responsive size factors
    • quality per format
    • helper defaults
  • Service provider config integration:
    • mergeConfigFrom(...)
    • publish tag: image-optimizer-config
  • Artisan command registration:
    • img:clear
    • img:warm
  • Memory-safe optimization fallback:
    • automatically serves original image when GD memory is insufficient
    • falls back to original image on optimization exceptions
  • Fallback metadata on rendered <img>:
    • data-image-optimizer-status="original-fallback"
    • data-image-optimizer-reason="memory-limit|optimization-error"
  • Pest test setup and suite:
    • tests/Pest.php
    • phpunit.xml.dist

Changed

  • Core helpers now use config-driven defaults in a backward-compatible way.
  • Improved dimension behavior:
    • no width/height -> original image dimensions are used
    • only one dimension provided -> the other is calculated proportionally
  • Updated README documentation for:
    • optional configuration
    • dimension auto-resolution behavior
    • memory-safe fallback and fallback metadata markers

Fixed

  • Commands not appearing in Artisan due to missing registration.
  • Fatal errors on large-image optimization without explicit dimensions (now handled via safe fallback).

Testing

  • Added comprehensive coverage for:
    • img, responsive_img, picture, img_url
    • config fallbacks and invalid config values
    • cache and command behavior
    • memory/error fallback behavior and metadata output

Upgrade Notes

  • No breaking changes.
  • Optional config publish command:
    • php artisan vendor:publish --tag=image-optimizer-config