Could Not Open Font
#1
Hello. I’m in a bit of a pickle right now. I’m currently using an Ubuntu Linux distribution. I’m trying to make a captcha system, but the image keeps on returning blank. I looked into the error logs of my web server, and the error logs say, “PHP message: PHP warning: imagettftext( ): Could not find/open font in (not comfortable sharing directory) on line 23”. Here is part of my code:

$dir = ‘Computer/usr/share/fonts/truetype/28DaysLater.ttf’ ;
imagettftext($image, {number}, {number}, {number}, {number}, $color, $dir, $_SESSION[‘captcha_code’]) ;

By the way, the {number} parts are parts that I feel somewhat insecure sharing and are also parts that I think are unimportant. I don’t think that there are any other bits of my code that are important to know, although please let me know if there’s any specific information or code that I can provide you. Anyway, I don’t know why I keep on getting this error and an empty captcha. Can somebody please give me some advice on how to solve this problem, like any downloads to make or any typing mistakes I may have made?
Reply
#2
Just read the docs:
https://www.php.net/manual/en/function.imagettftext.php

The filename should not include the extension, and I'm pretty sure 'Computer' shouldn't prefix the rest of the path. Then again, I'm not a PHP dev, so I can't tell you exactly what works and what doesn't.

Apparently it could also be a direct result of having an old version of GD as well, as noted in the docs, but that might be unlikely if you're running some newer version of Ubuntu.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Bracket Match Not Found IngloRex 1 16,485 12-23-2020, 02:34 AM
Last Post: poppopret
  Swift is now open source execve 6 19,408 12-25-2015, 12:48 AM
Last Post: Mr.Masked
  C# Open Source Browser Fusion 8 33,068 06-25-2015, 08:21 PM
Last Post: Fusion