File does not exits or found
According to the PHP manual, file_exists accepts as its argument the filename: a path to the file or directory, not a URL to it. It doesn't access files using an HTTP request. I bet file_exists('/captcha/font/impact.ttf')
would return true!
Try:
$font_path = realpath($image_path . 'font/impact.ttf');
The problem is that base_url()
returns a URL and you need to be looking on the local filesystem using the full path (e.g. /home/yoursite/public_html/captcha/font/impact.ttf
)