strukt/pkg-asset

Simple Asset Finder

Installs: 23

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:strukt-module

v1.0.8-alpha 2025-04-07 22:05 UTC

README

Installation

composer require strukt/pkg-asset:v1.0.8-alpha

If need be you need to install the middlewares, providers and commands:

./xcli publish:package pkg-asset

Usage

Environment Variables

You may put a reference in .env for your static directory.

rel_static_dir = static

You will also need to make sure you bootstrap.

Env::withFile(".env");
env("root_dir", getcwd());

Simple Asset Manager

// $finder = new \Strukt\Asset($root_dir, $static_dir);
// $finder = asset($root_dir, $static_dir);
$finder = asset();
$finder->exists("/js/script.js");
$finder->getInfo("/js/script.js");//SplFileInfo
$finder->get("/js/script.js");//returns contents of file

Image Resize

$image = new \Gumlet\ImageResize();
$image = new \Gumlet\ImageResize('image.jpg');
$image->scale(50);
$image->save('image2.jpg')

$image = new \Gumlet\ImageResize('image.jpg');
$image->resizeToHeight(500);
$image->save('image2.jpg')

Credits

For more on Gumlet see Gumlet/ImageResize on Github.