coyotito / image-resizer
Image resize plugin for NativePHP Mobile (iOS ImageIO + Android Bitmap).
Package info
github.com/coyotito-mx/image-resizer
Type:nativephp-plugin
pkg:composer/coyotito/image-resizer
v0.1.0
2026-05-26 01:06 UTC
Requires
- php: ^8.2
- nativephp/mobile: ^3.2
Requires (Dev)
- pestphp/pest: ^3.0
README
NativePHP Mobile plugin that downscales images using native APIs — ImageIO on iOS and BitmapFactory on Android.
Install
composer require coyotito/image-resizer
Register the plugin it the NativeServiceProvider:
public function plugins(): array { return [ \Coyotito\ImageResizer\ImageResizerServiceProvider::class, ]; }
Usage
use Coyotito\ImageResizer\Facades\ImageResizer; $ok = ImageResizer::resize( sourcePath: '/abs/path/to/source.jpg', targetPath: '/abs/path/to/target.jpg', maxSide: 1024, // longest side cap; preserves aspect ratio, no upscale quality: 80, // JPEG quality, 0-100 );
Returns true on success, false otherwise. Target is always written as JPEG. EXIF orientation is respected on both platforms.
Platform notes
| Feature | iOS | Android |
|---|---|---|
| Decoder | CGImageSource (ImageIO) |
BitmapFactory with inSampleSize |
| EXIF orientation | Auto via thumbnail transform | Explicit via ExifInterface |
| Output format | JPEG | JPEG |
| Memory efficiency | Thumbnail API streams from disk | inSampleSize downsamples on read |