簡體   English   中英

字體可在localhost上使用,但不能在實時服務器上使用

[英]Fonts working on localhost but not on live server

我正在使用imagettftext()在圖像上創建文本。 我使用了次新的羅馬字體,該應用程序可以在我的開發機器上正常工作,但不能在實時環境中使用。

請離開。 是我開發的嗎? Windows和Live中的計算機是Linux嗎?

請幫忙

實際問題是我的locahost上的文本顯示為“ Monster”,但在實時服務器上的“ Mo nster”上,這不僅與O一起出現,而且與其他字母一起出現...

$font = './fonts/times.ttf';    

$bbox = imagettfbbox(30, 0, $font, $word);

$x = $bbox[0] + (imagesx($src) / 2) - ($bbox[4] / 2);
$y = $bbox[1] + (imagesy($src) / 2) - ($bbox[5] / 2)+212;

imagettftext($src, 30, 0, $x, $y, $color, $font, $word);

$bbox2 = imagettfbbox(18, 0, $font, $definition);

$x = $bbox2[0] + (imagesx($src) / 2) - ($bbox2[4] / 2);
$y = $bbox2[1] + (imagesy($src) / 2) - ($bbox2[5] / 2)+245;

imagettftext($src, 18, 0, $x, $y, $white, $font, $definition);

我有同樣的錯誤,我的問題是字體定義擴展。 是ttf,不是ttf。 檢查文件擴展名的大小寫。

是的,可能未在Linux服務器上安裝該字體(實時)

我很早就弄清楚了,問題出在php版本上,正如我所看到的關於該問題的報告錯誤以及快速修復一樣

鏈接添加如下

錯誤: http//bugs.php.net/bug.php? id = 51571

解決方案:(不更改PHP版本)

http://www.php.net/manual/zh/function.imagettftext.php (請參閱sk89q的解決方案)

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM