1. Go to this page and download the library: Download brendt/responsive-images library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brendt / responsive-images example snippets
use Brendt\Image\ResponsiveFactory;
$factory = new ResponsiveFactory();
$image = $factory->create('img/image.jpeg');
// Without rebase
$options = [
'sourcePath' => './src/images',
'publicPath' => './public',
];
$image = $factory->create('/img/responsive/image.jpeg');
// Source file is searched in './src/images/img/responsive/image.jpeg'
// Public files are saved in './public/img/responsive/image-x.jpg'
// With rebase
$options = [
'sourcePath' => './src/images',
'publicPath' => './public',
'rebase' => true,
];
$image = $factory->create('/img/responsive/image.jpeg');
// Source file is searched in './src/images/image.jpeg'
// Public files are saved in './public/img/responsive/image-x.jpg'
html
<img src="<?= $image->src()
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.