PHP Script using gd with no result

Hello,
I try to use gd to make a small image in a get post process but i don’t success
Something to do to use gd ?

     $thumb = imagecreatetruecolor(80, 100);

// list($new_width, $new_height) = getimagesize($thumb);

    $text_color = imagecolorallocate($thumb, 233, 14, 91);
    imagestring($thumb, 1, 5, 5,  'text to show', $text_color);

     $b64 = base64_encode($thumb);

     $record['bitmapdata'] = $b64;
     $content['resource'][$k] = $record;

Bitnami dreamfactory 2.12

Thanks for advices

Only a php mistake :

     ob_start(); // Let's start output buffering.
     imagejpeg($thumb); //This will normally output the image, but because of ob_start(), it won't.
     $contents = ob_get_contents(); //Instead, output above is saved to $contents
     ob_end_clean(); //End the output buffer.

     $b64 = base64_encode($contents);