Jump to content
xisto Community
rvalkass

Freetype, Gd And An Error I just cant get FreeType to work

Recommended Posts

Basically I have this code:

 

header("Content-type: image/png");$bgimg = "bg.png";$im = imagecreatefrompng($bgimg);$number = rand(10,99);$textcolour = imagecolorallocate($im, 255, 255, 255);$font = "arial.ttf";imagettftext($im, 65, 0, 5, 95, $textcolour, $font, $number);imagepng($im);imagedestroy($im);

Unfortunately all I get is the blank placeholder for an image (or the red X if you still use IE) rather than my actual image. I have honed the problem down to the imagettftext line, as I have tried replacing it with imagestring and it works OK. I think the problem is with the font, but I just can't work it out.

 

I know that for this to work you need the GD and FreeType libraries. Last time I checked (ages ago :) ) Xisto had both these installed. Were the libraries removed, so we are just missing the libraries or have I done something wrong with my code?

 

Any help is greatly appreciated and thanks in advance.

Share this post


Link to post
Share on other sites

Your GD version might not be supporting imagettftext functionTry the following function:imagestring ( resource image, int font size, int x, int y, string s, int col )This is supported by all versions of GD library.But in this function the text that will be written over the Image will be a little ugly as u cant give the type of Font u want.Hope this helps and have a good day.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.