<commit_before><?php


function createEmailPic($jid, $email) {
    $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);
}<commit_msg>Fix fatal error from Imagick when creating email picture<commit_after><?php


function createEmailPic($jid, $email) {
    $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();
    try {
        $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);
    } catch (ImagickException $e) {
        error_log($e->getMessage());
    }
}
{'fraction_non_alphanumeric': 0.19510582010582012, 'fraction_numerical': 0.006613756613756613, 'mean_word_length': 3.864951768488746, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3793177', 'n_tokens_mistral': 539, 'n_tokens_neox': 516, 'n_words': 73}