Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-02-2011, 01:17 PM   PM User | #1
jayminkey
New Coder

 
Join Date: Apr 2009
Location: Ahmedabad,India
Posts: 54
Thanks: 4
Thanked 0 Times in 0 Posts
jayminkey is an unknown quantity at this point
Unhappy PHP imagettftext not working

Hi,

On my Linux based server imagettftext not working.

Here is my code,
PHP Code:

            
//ImageTTFText($image, $size, 0, $x, $y, $text_color, '/path/to/font.ttf', 'THIS TEXT WILL BE SHOWN');
            //imagettftext(
            // Set the content-type
            
header('Content-type: image/png');            
            
// Create the image
            
$im imagecreatetruecolor(40030);            
            
// Create some colors
            
$white imagecolorallocate($im255255255);
            
$grey imagecolorallocate($im128128128);
            
$black imagecolorallocate($im000);
            
imagefilledrectangle($im0039929$white);            
            
// The text to draw
            
$text 'Testing';
            
// Replace path by your own font path
            
$font 'customfonts/FrangipaniRose.ttf';            
            
// Add some shadow to the text
            //imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);            
            // Add the text
            
imagettftext($im2001020$white$font$text);            
            
// Using imagepng() results in clearer text compared with imagejpeg()
            
imagepng($im);
            
imagedestroy($im); 
It is showing me as some ascii characters.

i have uploaded font using Web Base FTP tool.

I went though different forums and according to that also try to upload font as binary file but on my server do not have facility to upload as binary file.

FYI,
I am using Parallels Plesk Control Panel.
Also i have checked my GD Support
GD Version = 2.0.34
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

Can anyone please help me in this.

Thanks,
Jaymin

Last edited by jayminkey; 03-02-2011 at 01:38 PM..
jayminkey is offline   Reply With Quote
Old 03-02-2011, 11:35 PM   PM User | #2
Shauny_B
New Coder

 
Join Date: Feb 2010
Location: UK, North West
Posts: 36
Thanks: 0
Thanked 5 Times in 5 Posts
Shauny_B is an unknown quantity at this point
Hello,
I've never tried using custom fonts on the GD class but I have a feeling it may not be working for the following:

A) Fonts are not installed on the linux box.
B) Fonts may require a full absolute path passing in the function.

Give those a try to see if it solves it.

Regards,
Shaun
Shauny_B is offline   Reply With Quote
Reply

Bookmarks

Tags
imagettftext, linux, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:10 AM.


Advertisement
Log in to turn off these ads.