render text as image |
[eluser]stoefln[/eluser]
is there a convenient way to render text as image (antialiasing) in CI? i found no helper/lib/whatever for this purpose...
[eluser]xwero[/eluser]
a quick google got me TextToImage function. Check the image library your are working with for more function. It's best you cache the images instead of rendering it on every page request.
[eluser]stoefln[/eluser]
[quote author="xwero" date="1213037435"]a quick google got me TextToImage function. Check the image library your are working with for more function. It's best you cache the images instead of rendering it on every page request.[/quote] yeah caching is exactly the point. would be great if there would be a library for generating cached text-images out of a config array. TYPO3 can do this out of the box, wondering.., its a feature which is quite often required IMO...
[eluser]xwero[/eluser]
Instead of caching you can create static images when you change or add the text. Caching is good but static is better.
[eluser]stoefln[/eluser]
[quote author="xwero" date="1213055373"]Instead of caching you can create static images when you change or add the text. Caching is good but static is better.[/quote] where is the difference between caching and static images?
[eluser]xwero[/eluser]
Caching works with time intervals, most of the time, which renders the images without need. A static image created when the text is added or changed only changes when it's necessary.
[eluser]stoefln[/eluser]
[quote author="xwero" date="1213067802"]Caching works with time intervals, most of the time, which renders the images without need. A static image created when the text is added or changed only changes when it's necessary.[/quote] i think i would need another caching algorithm in both cases: i think it should be able to check if there has been any change in one of the parameters (font, fontsize,..). cause i dont want to delete all files manually if i have to change a rendering-property. so my aproach would be to create a checksum over the configuration array and use this checksum as filename...
[eluser]stoefln[/eluser]
So, finally heres my text2image_helper.php, hope you like i: Code: <?php
[eluser]Ajeesh[/eluser]
i used this code, but the generated image had 1024 width and height 15 and the enterd text showing in a single line. Then i gave breaks bt its not working. |
Welcome Guest, Not a member yet? Register Sign In |