coyotito/image-resizer

Image resize plugin for NativePHP Mobile (iOS ImageIO + Android Bitmap).

Maintainers

Package info

github.com/coyotito-mx/image-resizer

Type:nativephp-plugin

pkg:composer/coyotito/image-resizer

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-05-26 01:06 UTC

This package is auto-updated.

Last update: 2026-05-26 01:18:00 UTC


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