swissup/module-image

Detect image dimensions

Installs: 85 592

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 1

Open Issues: 0

Type:magento2-module

1.0.7 2023-04-21 07:16 UTC

This package is auto-updated.

Last update: 2024-03-21 09:08:24 UTC


README

swissup/module-image - is a Magento module to calculate image dimensions using PHP. It uses getimagesize function when image is found in filesystem, otherwise uses fallback to marc1706/fast-image-size library. Supported formats: bmp, gif, ico, iff, jp2, jpeg, png, psd, svg, tif, wbmpm, webp.

Installation

composer require swissup/module-image
bin/magento setup:upgrade

Usage

use Swissup\Image\Helper\Dimensions;

$this->dimensions->getWidth($imageUrl);      // 600
$this->dimensions->getHeight($imageUrl);     // 400
$this->dimensions->getDimensions($imageUrl); // ['width' => 600, 'height' => 400]