Issues (31)

examples/watermark/index.php (1 issue)

Labels
Severity
1
<?php
2
3
use Compolomus\Compomage\Image;
4
5
require '../../vendor/autoload.php';
6
7
// test GD
8
9
$base64_image = base64_encode(file_get_contents('../test.jpg'));
10
11
$img = new Image($base64_image, Image::GD);
12
$watermark = new Image('ImageMagick.png', Image::GD);
13
echo '<img src="data:image/png;base64,' . $watermark->resizeByHeight(100)->getBase64() . '" alt="base64_image" style="background-color: white;" />';
14
$watermark->resizeByHeight(100);
15
$img->watermark($watermark, 'CENTER');
16
$img->copyright('GD test', realpath('../couri.ttf'), 'SOUTHEAST');
0 ignored issues
show
The method copyright() does not exist on Compolomus\Compomage\Image. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
$img->/** @scrutinizer ignore-call */ 
17
      copyright('GD test', realpath('../couri.ttf'), 'SOUTHEAST');
Loading history...
17
echo '<img src="data:image/png;base64,' . $img->getBase64() . '" alt="base64_image" style="background-color: orange;" />';
18
19
if (extension_loaded('imagick')) {
20
// test Imagick
21
22
	$img = new Image($base64_image, Image::IMAGICK);
23
	$watermark = new Image('ImageMagick.png', Image::IMAGICK);
24
	$watermark->resizeByHeight(100);
25
	$img->watermark($watermark, 'CENTER');
26
    $font = $img->getFontsList()[0];
27
	$img->copyright('Imagick test', $font, 'SOUTHEAST');
28
	echo '<img src="data:image/png;base64,' . $img->getBase64() . '" alt="base64_image" style="background-color: orange;" />';
29
} else {
30
	echo 'Imagick not supported';
31
}
32