...

View Full Version : Generating Images in Japanese >.<



Eugeniu
07-17-2008, 12:15 AM
I'm REALLY confused with generating images using GD. I have the font, size for font, font color, color background, image size, etc, but I have no idea how to put it together. I want to make a transparent image 200x30 pixels large that has a word in Japanese (picked from a database) in the center of it using msgothic.ttc as the font and font size 24 in black.

I've seen many examples but I'm just utterly confused. I tried to put things together, but I always get like a dozen errors if I don't use the exact code of examples. And that's pretty much useless. So can anyone show me how to do this?

Fou-Lu
07-17-2008, 12:28 AM
Image creation is always complicated in any language. Rather than walk you through it which will likely be more confusing for you, I would suggest trying things one by one.
Start with a simple image, 200x30 and change its background colours. Once you can do that, you have the base.
After that, work on adding the text for the image. Text is IMO the most difficult thing to do with the GD libraries, alignments are a pain and wrapping doesn't exist so you need to do calculations. A single character will be fine. This assumes you have access to msgothic or have uploaded the file and that the character you require exists within the set.

The function(s) you will need are:
imagecreate / imagecreatetruecolor
imagecolorallocate
imagettftext
imagettfbox
image* (imagepng, imagejpg, etc for actual output)
imagedestroy
header

As I mentioned, the most difficult part will be the alignment of the graphic, and the existence of it. I don't know what fontset you'll need to use that has the glyph in it you require.

Try using these, come back with specific problems.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum