Passed
Branch master (8718bd)
by compolom
06:34 queued 02:28
created

crop.php ➔ out_base64()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Compolomus\Compomage\Image;
4
5
require '../../vendor/autoload.php';
6
7
/**
8
 * @param array $args
9
 * @return string
10
 * @throws Exception
11
 */
12
function out_base64(array $args): string
13
{
14
        $obj = new Image($args['image'], Image::GD); // Image::IMAGICK
15
    return '<img src="data:image/png;base64,' . $obj->crop((int) $args['width'], (int) $args['height'], (int) $args['x'], (int) $args['y'])->getBase64() . '" alt="base64_image" />'
16
        . '<div>input w h x y = ' . implode(' | ',  [$args['width'], $args['height'], $args['x'], $args['y']]) . '</div>';
17
}
18
19
echo out_base64($_REQUEST);
20