-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Raphaël Gertz
committed
Nov 22, 2024
1 parent
5c417dd
commit 0ae04c5
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Rapsys PackBundle package. | ||
* | ||
* (c) Raphaël Gertz <symfony@rapsys.eu> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
//Create image object | ||
$image = new Imagick(); | ||
|
||
//Create draw object | ||
$draw = new ImagickDraw(); | ||
|
||
//Create pixel object | ||
$pixel = new ImagickPixel('white'); | ||
|
||
//Create new image | ||
$image->newImage(1200, 630, $pixel); | ||
|
||
//Set fill color | ||
$draw->setFillColor('black'); | ||
|
||
//Set font properties | ||
$draw->setFont('../woff2/droidsans.regular.woff2'); | ||
$draw->setFontSize(30); | ||
|
||
//Add texts | ||
$image->annotateImage($draw, 10, 35, 0, 'RP'); | ||
$image->annotateImage($draw, 10, 615, 0, 'RP'); | ||
$image->annotateImage($draw, 1155, 35, 0, 'RP'); | ||
$image->annotateImage($draw, 1155, 615, 0, 'RP'); | ||
|
||
//Set image format | ||
$image->setImageFormat('png'); | ||
|
||
//Output image header | ||
header('Content-type: image/png'); | ||
|
||
//Output image | ||
echo $image; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.