]> Raphaël G. Git Repositories - packbundle/blob - public/facebook/source.php
Remove default format value
[packbundle] / public / facebook / source.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys PackBundle package.
5 *
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 //Create image object
13 $image = new Imagick();
14
15 //Create draw object
16 $draw = new ImagickDraw();
17
18 //Create pixel object
19 $pixel = new ImagickPixel('white');
20
21 //Create new image
22 $image->newImage(1200, 630, $pixel);
23
24 //Set fill color
25 $draw->setFillColor('black');
26
27 //Set font properties
28 $draw->setFont('../woff2/droidsans.regular.woff2');
29 $draw->setFontSize(30);
30
31 //Add texts
32 $image->annotateImage($draw, 10, 35, 0, 'RP');
33 $image->annotateImage($draw, 10, 615, 0, 'RP');
34 $image->annotateImage($draw, 1155, 35, 0, 'RP');
35 $image->annotateImage($draw, 1155, 615, 0, 'RP');
36
37 //Set image format
38 $image->setImageFormat('png');
39
40 //Output image header
41 header('Content-type: image/png');
42
43 //Output image
44 echo $image;