Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
07-17-2008, 12:15 AM #1
- Join Date
- Feb 2008
- Thanked 0 Times in 0 Posts
Generating Images in Japanese >.<
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?
07-17-2008, 12:28 AM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,650 Times in 2,619 Posts
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
image* (imagepng, imagejpg, etc for actual output)
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.PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');
Users who have thanked Fou-Lu for this post: