2015-08-03 11:35:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
function createEmailPic($jid, $email) {
|
2015-12-15 11:54:49 +01:00
|
|
|
$cachefile = DOCUMENT_ROOT.'/cache/'.$jid.'_email.png';
|
|
|
|
|
|
|
|
if(file_exists(DOCUMENT_ROOT.'/cache/'.$jid.'_email.png'))
|
|
|
|
unlink(DOCUMENT_ROOT.'/cache/'.$jid.'_email.png');
|
|
|
|
|
|
|
|
$draw = new ImagickDraw();
|
|
|
|
$draw->setFontSize(13);
|
|
|
|
$draw->setGravity(Imagick::GRAVITY_CENTER);
|
|
|
|
|
|
|
|
$canvas = new Imagick();
|
|
|
|
|
|
|
|
$metrics = $canvas->queryFontMetrics($draw, $email);
|
|
|
|
|
|
|
|
$canvas->newImage($metrics['textWidth'], $metrics['textHeight'], "transparent", "png");
|
|
|
|
$canvas->annotateImage($draw, 0, 0, 0, $email);
|
|
|
|
|
|
|
|
$canvas->setImageFormat('PNG');
|
|
|
|
$canvas->writeImage($cachefile);
|
2015-08-03 11:35:01 +02:00
|
|
|
}
|