We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

create captcha image in phalcon OR how to convert text to image with phalcon?

Hello

how to create captcha image like this in phalcon:

// Create a 100*30 image
$im = imagecreate(100, 30);

// White background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// Write the string at the top left
imagestring($im, 5, 0, 0, 'Hello world!', $textcolor);

// Output the image
header('Content-type: image/png');

// 

imagepng($im);
imagedestroy($im);

when use this code in phalcon framework have one error :

cannot be displayed because it contain error

OR how to convert text to image with phalcon????

Have you tried seeing what the error is in the PHP error log? If you comment out the header(); function the error will also be displayed to the browser.

Check gd extension...