Skip to content

v2.5.0

Choose a tag to compare

@farisc0de farisc0de released this 31 Mar 02:38
· 12 commits to main since this release

PhpFileUploading Library 2.5.0 - Release Notes

Overview

We're excited to announce the release of PhpFileUploading v2.5.0, featuring significant enhancements to the core components of the library. This update focuses on improving reliability, security, and performance across all classes, with particular attention to the Image and File classes.

What's New

Image Class Improvements

  • Enhanced Resource Management: Implemented try/finally blocks to ensure proper cleanup of image resources in all circumstances
  • Better Transparency Handling: Added consistent transparency preservation for PNG images across all manipulation methods
  • Improved MIME Type Detection: Created a robust fallback system for determining image types when standard PHP functions are unavailable
  • Memory Optimization: Added temporary memory limit adjustments for processing large images
  • GD Extension Validation: Added explicit checks for GD library availability to prevent cryptic errors
  • Better Error Handling: More specific error messages and improved exception handling

File Class Enhancements

  • Robust File Validation: Improved validation of uploaded file arrays with more specific type checking
  • Enhanced MIME Type Detection: Implemented a multi-layered approach with fallbacks for reliable MIME type identification
  • Memory-Efficient File Hashing: Added streaming approach for hashing large files (>10MB) to prevent memory issues
  • Improved Empty File Detection: Enhanced detection of empty uploads with multiple condition checks
  • File Integrity Verification: Added size consistency checks between reported and actual file sizes
  • Better Error Handling: More specific error messages and improved exception handling

General Improvements

  • Code Quality: Enhanced code structure and readability across all classes
  • Error Handling: More consistent and informative error messages
  • Security: Improved validation and sanitization of inputs
  • Performance: Optimized resource usage for better performance with large files

Breaking Changes

  • The Image class now throws an exception if the GD extension is not available
  • The File::isEmpty() method now uses stricter criteria to determine if a file is empty
  • Error handling is more strict, with exceptions thrown earlier in the process

Upgrade Instructions

This release maintains backward compatibility with existing code that follows best practices. However, if your code relies on specific error handling behaviors or makes assumptions about resource management, we recommend testing thoroughly before upgrading in production.

Future Plans

In upcoming releases, we plan to introduce additional features to the Image class including:

  • Image cropping functionality
  • Image rotation and flipping
  • Thumbnail generation
  • EXIF data handling
  • Advanced watermarking options