เจอปัญหาตอนเรียก path font มาใช้งาน error imagettfbbox(): Could not find/open font

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: เจอปัญหาตอนเรียก path font มาใช้งาน error imagettfbbox(): Could not find/open font

Re: เจอปัญหาตอนเรียก path font มาใช้งาน error imagettfbbox(): Could not find/open font

โดย thatsawan » 14/05/2019 3:51 pm

เปลี่ยนวิธีมใช้ https://www.abeautifulsite.net/the-simp ... ss-for-php ทำงานได้เเล้ว

เจอปัญหาตอนเรียก path font มาใช้งาน error imagettfbbox(): Could not find/open font

โดย thatsawan » 11/05/2019 5:52 pm

ตัวอย่าง code จาก
https://github.com/verot/class.upload.p ... upload.php

โค้ด: เลือกทั้งหมด

 $handle->image_text            = "люблю";
        $handle->image_text_background = '#000000';
        $handle->image_text_padding    = 10;
        $handle->image_text_size       = 20;
        $handle->image_text_angle      = 20;
        $handle->image_text_font       = "./foo.ttf";

ลองมาใช้งานจริงที่ phpbb ปรากฏว่า อักษรบนภาพไม่เปลี่ยนตาม font ของที่เราเรียก

โค้ด: เลือกทั้งหมด

 $font_path = $this->root_path  . '/images/facebook/angsa.ttf'; 
[phpBB Debug] PHP Warning: in file [ROOT]/upload.php on line 4450: imagettfbbox(): Could not find/open font


โค้ด: เลือกทั้งหมด

            $font_path = generate_board_url()  . '/images/facebook/angsa.ttf'; #"http://localhost/phpBB3/images/facebook/angsa.ttf"
ถ้าเรียกเเบบนี้จะไม่ error เเต่ก็ อักษรก็ไม่เปลี่ยนตาม font

โค้ด: เลือกทั้งหมด

 $font_path = $this->root_path  . '/images/facebook/foo.gdf'; 
ถ้าเป้น กรณี .gdf เรียกเเบบนี้ทำงานได้ปกติ เเต่ไม่รู้มันเป็นไฟล์อะไร

ข้างบน