PHP code example of mapado / image-url-builder

1. Go to this page and download the library: Download mapado/image-url-builder 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/ */

    

mapado / image-url-builder example snippets


use Mapado\ImageUrlBuilder\Builder;

$builder = new Builder();

$width = 800;
$height = 600;
$url = $builder->buildUrl('2018/01/foo.jpg', $width, $height);

// will output '//img.mapado.net/2018/01/foo_thumbs/800-600.jpg'

$httpUrl = $builder
    ->withHttpPrefix()
        ->buildUrl($slug, $width, $height);
// will output `http://img.mapado.net/xxxx...`

$httpsUrl = $builder
    ->withHttpsPrefix()
        ->buildUrl($slug, $width, $height);
// will output `https://img.mapado.net/xxxx...`