CodeIgniter Forums
create image with text and save to folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: create image with text and save to folder (/showthread.php?tid=38383)



create image with text and save to folder - El Forum - 02-07-2011

[eluser]Random dude[/eluser]
I'm making a site that shows a lot of Japanese calligraphy. I want to be able to show Japanese calligraphic fonts on the site, therefore the only option is save images of the Japanese characters and then use those images.

The goal:
After retrieving a Japanese character (a utf-8 string) from the database
-create a .png image using the string and a font file,
-and then save the image to the filesystem.


Can anyone point me in the right direction? All the tutorials I can find on the net focus on sending the created image to the browser which is quite different from what I want to do, so I was wondering if anyone had any resources or ideas they could point me to.

Thanks heaps in advance. I guess I'll have to just piece together the above steps separately to reach the correct solution. And cheers to CodeIgniter 2.0!

Nicholas.


create image with text and save to folder - El Forum - 02-07-2011

[eluser]Mat-Moo[/eluser]
If you have a ttf font file, then simply load it, and write the characters to an image with http://php.net/manual/en/function.imagettftext.php that would be the simplest solution.

As fasr as sending images to teh browser or to a file, instead of using imagejpeg($im) to write to the screen, use imagejpeg($im, 'filename.jpg');