lthn.io/app/Core/Media/Thumbnail/helpers.php
Claude 41a90cbff8
feat: lthn.io API serving live chain data
Fixed: basePath self→static binding, namespace detection, event wiring,
SQLite cache, file cache driver. All Mod Boot classes converted to
$listens pattern for lifecycle event discovery.

Working endpoints:
- /v1/explorer/info — live chain height, difficulty, aliases
- /v1/explorer/stats — formatted chain statistics
- /v1/names/directory — alias directory grouped by type
- /v1/names/available/{name} — name availability check
- /v1/names/lookup/{name} — name details

Co-Authored-By: Charon <charon@lethean.io>
2026-04-03 17:17:42 +01:00

45 lines
1.3 KiB
PHP

<?php
/*
* Core PHP Framework
*
* Licensed under the European Union Public Licence (EUPL) v1.2.
* See LICENSE file for details.
*/
use Core\Media\Thumbnail\LazyThumbnail;
if (! function_exists('lazy_thumb')) {
/**
* Get a lazy thumbnail URL for an image.
*
* Usage in Blade:
* ```blade
* <img src="{{ lazy_thumb('uploads/photo.jpg', 200, 200) }}" alt="Photo">
* ```
*
* @param string $sourcePath Path to the source image
* @param int $width Target width in pixels
* @param int $height Target height in pixels
* @return string The thumbnail URL
*/
function lazy_thumb(string $sourcePath, int $width, int $height): string
{
return app(LazyThumbnail::class)->url($sourcePath, $width, $height);
}
}
if (! function_exists('lazy_thumb_exists')) {
/**
* Check if a lazy thumbnail has been generated.
*
* @param string $sourcePath Path to the source image
* @param int $width Target width in pixels
* @param int $height Target height in pixels
* @return bool True if thumbnail exists
*/
function lazy_thumb_exists(string $sourcePath, int $width, int $height): bool
{
return app(LazyThumbnail::class)->exists($sourcePath, $width, $height);
}
}