[[Text2PNG?font=`fontname.ttf`&option=`value`]]
I am trying to implement Gtext in my template Like This:
<div id="header">
<h1><a href="[~[(site_start)]~]" title="[(site_name)]"><img alt="[(site_name)]" src="[[gtext? &font=`rage.ttf` &fontsize=`18` &color=`#ffffff` &bgcolor=`#000000` &text=`[(site_name)]`]]" /></a></h1>
</div>
<!-- close #header -->
I have uploaded the font to /assets/files/fonts.
I am getting this error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
Error: imagettfbbox(): Could not find/open font
Error type/ Nr.: Warning - 2
File: /homepages/7/d165971201/htdocs/manager/includes/document.parser.class.inc.php(705) : eval()’d code
Line: 208
Parser timing
MySQL: 0.0066 s s (3 Requests)
PHP: 0.0699 s s
Total: 0.0764 s s
How can I fix This?
I will let you guys off.
imagettfbbox(): Could not find/open font
)Use backticks in the snippet parameters, so it would be [[Text2PNG? &font=`htower.ttf` &text=`Testing...`]]
I called it with: [[Text2PNG? &font=’htower.ttf’ &text=’Testing...’]]
duh. Now THAT was embarrassing....I tried this snippet my self too in local test enviroment and got same results. Did some searching around and it seems that there is/was some bugs in php imagettfbbox() function. First, it wants the full path to the font (what this snippet is giving, so that’s ok) but it doesn’t allow any spaces to be in the path to the font file. As my docroot was under "C:\Documents and settings\.." it didn’t work for me. Then I tried it with my linux box that has no spaces in docroot and it worked ok.
I am using backticks in my example, but I still have the error.
Oh yeah, usually anything relating to paths and filenames are case sensitive, great that you got it working!
It seems that the font path is case-sensitive also.