thinktomorrow/assetlibrary
A Laravel package for managing uploaded assets and media files in one central library, making it easy to store, organize, and retrieve images and other files across your application.
0.7.4 in a branch and run the package test suite plus your application’s image/asset tests.Asset API for getWidth() and getHeight(), and at deleteAsset() to confirm its return/exception behavior in your integration.$asset = Asset::findOrFail($assetId);
$width = $asset->getWidth();
$height = $asset->getHeight();
$asset->deleteAsset();
getWidth() / getHeight() when rendering images or validating aspect ratios instead of calling PHP image functions directly. Use deleteAsset() in cleanup jobs where the asset may already be gone.$asset = Asset::findOrFail($id);
$ratio = $asset->getHeight() > 0
? $asset->getWidth() / $asset->getHeight()
: null;
$validator->after(function ($validator) use ($asset) {
if ($asset->getWidth() < 1200) {
$validator->errors()->add('asset', 'Image must be at least 1200px wide.');
}
});
deleteAsset(), code can call it without a separate pre-check, but still handle the package’s documented return value or exceptions:foreach ($staleAssets as $asset) {
$asset->deleteAsset();
}
0.7.4 changes dimension calculations.getWidth() / getHeight() behavior for unsupported or unusual assets such as SVG, PDF, remote streams, or missing files. Guard against null, 0, or package-specific exceptions.deleteAsset() makes deletion safer for repeatable jobs, but do not use it as a substitute for monitoring missing assets. Log or report skipped deletions if missing files indicate a data issue.How can I help you explore Laravel packages today?