HTML is not enough to render a modern website. JavaScript, CSS, images, and videos also play a significant role. Bear Framework enables you to handle such assets with ease. The $app->assets object can give you a public URL for a particular asset. You can even resize images on the fly. The only requirement is that the files must be in a registered directory.
use BearFramework\App;
$app = App::get();
// You can register a directory to be publicly accessible and get file url
$app->assets->addDir('../app/assets');
$app->assets->getURL('../app/assets/logo.png');
// You can retrieve URLs for data items too.
$app->assets->addDir('appdata://products/images');
$app->assets->getURL('appdata://products/images/1.jpg');
// It even works in contexts.
$context = $app->contexts->get();
$context->assets->addDir('assets');
$context->assets->getURL('assets/logo.png');
In the options argument you can specify the width or the height or both of the desired image.
use BearFramework\App;
$app = App::get();
// Retrieves a urls for the resized versions.
$app->assets->getURL('assets/logo.png', ['width' => 300]); // height is automatically calculated
$app->assets->getURL('assets/logo.png', ['width' => 300, 'height' => 200]);