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 

// You can retrieve URLs for data items too.

// It even works in contexts.
$context $app->contexts->get();

Image resizing

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]);

Learn more

Handle HTTP requests
Store and retrieve data

The information on this page is created for version 1.1 of Bear Framework and may not be applicable for other versions of the framework.