Last active
January 4, 2016 03:09
-
-
Save serefyarar/8559903 to your computer and use it in GitHub Desktop.
Transparent text with imagemagick
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
<?php | |
$position = 'waist'; | |
$size = 'normal'; | |
$letters = 'SRT'; | |
$color = "000000"; | |
$font = 'arial'; | |
$positions = array( | |
'waist'=>array(358,440,-6) | |
); | |
$sizes = array( | |
'normal'=>array(415,503), | |
'zoom'=>array(415,503), | |
); | |
$image = new Imagick(); | |
$draw = new ImagickDraw(); | |
$pixel = new ImagickPixel("rgba(255,255,255,0)"); | |
$image->newImage($sizes[$size][0], $sizes[$size][1], $pixel); | |
$draw->setFillColor($color); | |
$draw->setFont($font.'.ttf'); | |
$draw->setFontSize(8); | |
$image->annotateImage($draw, $positions[$position][0], $positions[$position][1], $positions[$position][2], $letters); | |
$image->setImageFormat('png'); | |
header('Content-type: image/png'); | |
echo $image; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment