Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Call to undefined function: imagettftext()
krzysiek0210
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.06.2005

Ostrzeżenie: (0%)
-----


Witam,
Chcąc wygenerować obrazek w php wyrzuca mi błąd:
Cytat
Call to undefined function: imagettftext()

Początkowo myślałem, że na serwerze brakuje biblioteki FreeType, jednak doinstalowałem ją a problem nadal występuje.
Cytat
'./configure' '--with-apxs' '--with-curl' '--with-curl-dir=/usr/local/lib' '--with-gd' '--with-gd-dir=/usr/local' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-mhash' '--with-mysql=/usr/local/mysql' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-xml' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--with-openssl' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-track-vars' '--enable-mbstring' '--enable-memory-limit' '--with-freetype-dir=/usr/lib' '--enable-gd-native-ttf'

Wie ktoś o co chodzi? Kod jest sprawdzony bo na poprzednim serwerze działał prawidłowo, błąd pojawił się dopiero po przeprowadzce.

Ten post edytował krzysiek0210 10.03.2008, 12:23:54
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 8)
PawelC
post
Post #2





Grupa: Zarejestrowani
Postów: 1 173
Pomógł: 121
Dołączył: 24.09.2007
Skąd: Toruń

Ostrzeżenie: (0%)
-----


Zobacz czy to Ci zadziała na serwerze:
  1. <?php
  2. header("Content-type: image/png");
  3. $im = imagecreatetruecolor(400, 30);
  4. $white = imagecolorallocate($im, 255, 255, 255);
  5. $grey = imagecolorallocate($im, 128, 128, 128);
  6. $black = imagecolorallocate($im, 0, 0, 0);
  7. imagefilledrectangle($im, 0, 0, 399, 29, $white);
  8. $text = 'Testing...';
  9. $font = 'arial.ttf';
  10. imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
  11. imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
  12. imagepng($im);
  13. imagedestroy($im);
  14. ?>

I oczywiście musisz wrzucić czcionke arial.ttf na serwer, a przy tym kodzie co teraz Ci nie działa, wklej go i czy wrzuciłeś plik ttf na serwer?
Go to the top of the page
+Quote Post
bim2
post
Post #3





Grupa: Zarejestrowani
Postów: 1 873
Pomógł: 152
Dołączył: 9.04.2006
Skąd: Berlin

Ostrzeżenie: (0%)
-----


~ExPloti co to mu da?
Jeśli wyskakuje błąd, że nie ma funkcji to jej nie ma. To, że podałes mu kod, który u ciebie działa nic nie zmieni, bo funkcja dzięki temu się nie pojawi.
Go to the top of the page
+Quote Post
krzysiek0210
post
Post #4





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.06.2005

Ostrzeżenie: (0%)
-----


kod ExPlOiT zwraca:
Cytat
Obrazek "http://xxx" nie może zostać wyświetlony, ponieważ zawiera błędy.


czego brakuje na serwerze ze nie obsługuje tej funkcji?
Go to the top of the page
+Quote Post
Cysiaczek
post
Post #5





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Zakładam, że freetype
Cytat
Notatka: This function requires both the GD library and the » FreeType library.
Go to the top of the page
+Quote Post
bim2
post
Post #6





Grupa: Zarejestrowani
Postów: 1 873
Pomógł: 152
Dołączył: 9.04.2006
Skąd: Berlin

Ostrzeżenie: (0%)
-----


Cytat
Notatka: This function requires both the GD library and the » FreeType library.

Coś musiałeś źle zainstalować.
Go to the top of the page
+Quote Post
Largo
post
Post #7





Grupa: Zarejestrowani
Postów: 203
Pomógł: 6
Dołączył: 11.09.2005

Ostrzeżenie: (0%)
-----


Witam,

Tak na moje oko, to chyba się pomyliłeś w ./configure:

--with-freetype=/usr/lib

A nie powinno być:

--with-freetype=/usr/local/lib

? Popatrz dokładnie na ścieżki, a jak nie, to Manual, Google i bibliotekę doinstalujesz :-)

Pozdrawiam,
Largo
Go to the top of the page
+Quote Post
krzysiek0210
post
Post #8





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 30.06.2005

Ostrzeżenie: (0%)
-----


Ścieżka raczej dobra bo plik /usr/lib/libfreetype.so istnieje.
Go to the top of the page
+Quote Post
Pilsener
post
Post #9





Grupa: Zarejestrowani
Postów: 1 590
Pomógł: 185
Dołączył: 19.04.2006
Skąd: Gdańsk

Ostrzeżenie: (0%)
-----


Cytat
błąd pojawił się dopiero po przeprowadzce.


Zainstaluj bibliotekę GD2, po instalacji sprawdź w phpinfo czy masz:

Cytat
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.12.2025 - 23:02