dinhnam2901/image-helper

Single class PHP for image helper with main feature as resize image, getting information of image file

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/dinhnam2901/image-helper

1.0.0 2023-03-03 09:13 UTC

This package is auto-updated.

Last update: 2026-01-16 16:25:21 UTC


README

Single class PHP for image helper.
Main feature:

  • Resize the image.
  • Getting information of image.

Basic usage

If you have a image at 'upload/image1.jpg' with: width=1000px, height=1200px.
And you want to resize it to 'thumb/image1.jpg' with width=300px, and remain ratio as the same (calc height automatically).
You can use bellow code:

$imageHelper = new ImageHelper();
$imageHelper->resize('upload/image1.jpg', 'thumb/image1', [
    ImageHelper::OPTION_WIDTH => 300
]);

Required

This image helper use GD library. So, ensure you was install and turn on the GD library on your web server.