Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2004-08-14 00:24:11
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_image_replace, version 2
> If I leave the tag as given in the plugin text, if I use corinne’s revision as shown here, if I put in fontdir=”/” or fontdir=“http://mydomainname.com/”, with or without forward-slashes all over the place, making a “fonts” folder in the root directory, in the public_html directory, in the textpattern directory – nothing seems to work! I either get a blank page or I get the aforementioned error.
“fontdir” is used to specify the local server directory name, which can be quite different to the path you see in URLs.
Take a look at your doc_root setting in the Textpattern config. It will typically (though not always) look like this:
$txpcfg['doc_root'] = '/home/example/public_html';
By default, the plugin assumes the font will be in /home/example/ – your home directory, outside the publically-accessible doc_root. This is so you can safely use a commercial font without risk of someone downloading it.
If you’re using a setting like font="fonts/foo.ttf" (without a fontdir), the plugin looks for it in /home/example/fonts/foo.ttf.
If you’ve placed the font in public_html/fonts, you’ll need to use font="public_html/fonts/foo.ttf". Or alternatively, fontdir="public_html/fonts" font="foo.ttf".
For most users on a shared vhost plan, the simplest thing to do is:
1. Upload the font file to your home directory – not public_html, but the directory that contains public_html. This will usually be the directory you start in when you use FTP.
2. Use a tag like this:
<txp:zem_image_replace font="myfont.ttf" position="right"><txp:page_title /></txp:zem_image_replace>
Last edited by zem (2004-08-14 00:45:22)
Alex
Offline
#17 2004-08-14 00:34:55
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_image_replace, version 2
> That’s a great idea, thanks a lot Zem.
Welcome.
> I have a newbie question: is the GD2/ImageMagick tool is used for each new visitor on the page (each new parsing of the TXP page/article), or is it cached somehow ?
It’s cached. The plugin generates it for the first page view only, and stores it in images/zir/.
> Another question: is it possible to create a default transparent (8bit, no alpha) background ? With an attribute to create alpha transparency (for the hardworker using MS filter to force IE to handle png alpha transparency) ?
I’m not quite sure what you’re asking. The current version always creates a transparent PNG. Next release will make that optional. Is that what you mean?
Alex
Offline
#18 2004-08-14 00:43:45
- starzabove
- Member

- Registered: 2004-04-13
- Posts: 76
Re: [plugin] [ORPHAN] zem_image_replace, version 2
Zem,
Thanks for the explanation, that is one of the many things that I have tried, but that setup gives me a blank page. Not even just my page with the font missing error, but NOTHING on the page whatsoever.
Thanks with your help on this, I would REALLY like to figure this out.
90+ Textpattern installs and still going…
Offline
#19 2004-08-14 00:55:25
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_image_replace, version 2
Starz,
A blank page usually indicates a syntax error of some kind – either an error in the plugin, or possibly some broken syntax in your <txp:...> tags (unclosed tags, missing quotes, etc). Without more information, my guess is as good as yours.
You could try editing publish.php and uncommenting the ERROR_REPORTING and ini_set lines near the top – that should at least let you see an error message.
If you can reproduce the blank page issue with a particular tag, please post an exact copy of the tag so I can find the cause and fix it.
It might also help if you posted:
- your doc_root setting
- the absolute path of your font file
You can send those to me via email if you’d prefer.
Alex
Offline
Re: [plugin] [ORPHAN] zem_image_replace, version 2
> zem wrote:
> It’s cached. The plugin generates it for the first page view only, and stores it in images/zir/.
Great.
>I’m not quite sure what you’re asking. The current version always creates a transparent PNG. Next release will make that optional. Is that what you mean?
I saw in your first post ??Background color, in #rrggbb format. Default is
Last edited by Jeremie (2004-08-14 01:22:05)
Offline
Re: [plugin] [ORPHAN] zem_image_replace, version 2
I’m guessing that it only supports .ttf fonts. Is there any possibility that .pfm or .otf fonts will be added or is it a limitation threw PHP that stops these lovely font formats?
Last edited by obeewan (2004-08-14 12:18:27)
Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
Re: [plugin] [ORPHAN] zem_image_replace, version 2
I had no problems with opentype .otf fonts.
But yes, only position=“right” works, and I don’t know how to use another image replacement trick that changes <span> tag with the image. <del>Example (static image) on my website as the header.</del>
css code for this technique:
<code>
.replace {position: relative; margin-left: 0.8em; padding: 0;
/* hide overflow: hidden from IE5/Mac */
/* \*/
overflow: hidden;
/* */
}
</code>
.replace span {display: block; position: absolute; top: 0; left: 0; z-index: 1; /* for Opera 5 and 6 */ }
#yourid, #yourid span {width: ...px; height: ...px; background-image: url(/path/to/image.gif);}
html example:
<h1 class="replace" id="yourid"><txp:page_title /><span> </span></h1>
Last edited by ChrisJ (2005-02-21 11:04:17)
Offline
#23 2004-08-15 00:18:45
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_image_replace, version 2
Chris,
You can’t do exactly that, but you can achieve something similar. Try putting the CSS in your stylesheet, and using code like this:
<code>
<txp:zem_image_replace font=“fonts/myfont.ttf” class=“replace” ><span><txp:page_title /></span></txp:zem_image_replace>
</code>
It won’t supply the width and height attributes, so it may not work.
Alex
Offline
#24 2004-08-15 08:11:02
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_image_replace, version 2
Version 0.3 is available for download. Full docs here.
New in this version:
- Freetype support (which may or may not mean Opentype support)
- anti-aliasing (requires Freetype)
- “angle” attribute, for arbitrary text rotation
- “info” attribute which might help debugging
- “depth” attribute, with 8/24 bit support
- “trans” attribute to select image transparency
- more explicit error messages
Knock yourselves out. If the “angle” thing doesn’t start a new fad, I’ll be bitterly disappointed.
Those who are having trouble with permissions or font files should try something like this:
<txp:zem_image_replace font=“myfont.ttf” info=1>test</txp:zem_image_replace>
..to see some useful information about paths and permissions.
Last edited by zem (2004-08-15 08:22:16)
Alex
Offline
#25 2004-08-15 08:17:00
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_image_replace, version 2
Obeewan,
Version 0.3 might support additional font formats, including .otf and Type 1, if you have GD2/Freetype installed. Or it might not, I haven’t been able to confirm either way. Maybe someone can tell me.
Alex
Offline
#26 2004-08-15 16:22:43
- starzabove
- Member

- Registered: 2004-04-13
- Posts: 76
Re: [plugin] [ORPHAN] zem_image_replace, version 2
> zem wrote:
> Version 0.3 is available for download. Full docs > here.
> New in this version: > * Freetype support (which may or may not mean Opentype support) > * anti-aliasing (requires Freetype) > * “angle” attribute, for arbitrary text rotation > * “info” attribute which might help debugging > * “depth” attribute, with 8/24 bit support > * “trans” attribute to select image transparency > * more explicit error messages > Knock yourselves out. If the “angle” thing doesn’t start a new > > fad, I’ll be bitterly disappointed. > Those who are having trouble with permissions or font files > > should try something like this: <code> <txp:zem_image_replace font=“myfont.ttf” info=1>test</txp:zem_image_replace> </code> > ..to see some useful information about paths and permissions. > > > >Since this might help someone that has not been able to get this type of function to work in any way, like me, with Zem’s great “info” attribute idea, this is what I just found out:
“freetype is not supported
GD is not supported”
Which is very weird since I run this server and GD is supported, and I have never come up with freetype not being supported and have even used embedded fonts, so just off the top of my head, would assume that to be an error.
I will research it on my server, but meanwhile do you, zem, or anyone else have a clue as to what I might do to further research or even fix this situation?
Thanks so much!
Last edited by starzabove (2004-08-15 16:24:39)
90+ Textpattern installs and still going…
Offline
#27 2004-08-15 18:29:12
- starzabove
- Member

- Registered: 2004-04-13
- Posts: 76
Re: [plugin] [ORPHAN] zem_image_replace, version 2
UPDATE…
I did an apache rebuild, since there was a new version out anyhow.
It seems it was the freetype not enabled that it was tripping up on with this plug-in and before when I tried to use the ALA technique myself.
Kudos to zem for coming up with a great way of getting down to the root of the problem- if only all plug-ins/scripts could have such a great built-in diagnostic tool!
VERY cool on the angle attribute zem, I am using it at 7 degrees, if nothing else to pay homage to your great efforts.
Now, my regular text from my <code><txp:title /></code> tag is still showing up on top of this png image of the title. Any ideas on what to do about this?
Thanks again!
90+ Textpattern installs and still going…
Offline
#28 2004-08-15 18:50:19
- starzabove
- Member

- Registered: 2004-04-13
- Posts: 76
Re: [plugin] [ORPHAN] zem_image_replace, version 2
Oh my gosh- I think I actually have something to contribute!
I went into the plugin text, changed this:
margin: 0 0 0 -5000px;
to this:
margin: 0;
then put the position=
Last edited by starzabove (2004-08-15 18:50:53)
90+ Textpattern installs and still going…
Offline
#29 2004-08-15 22:40:15
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [plugin] [ORPHAN] zem_image_replace, version 2
> margin: 0 0 0 -5000px;
> to this:
> margin: 0;
I think you’ll find this causes overwritten text in many browsers. The point of the ‘-5000px’ is to shift the text offscreen, so only the image is visible.
If you’re seeing overwritten text with the -5000px margin, it’s probably because of an interaction with some other CSS on the page. Could also be a browser incompatibility.
Can you post a URL that demonstrates the problem?
Alex
Offline
#30 2004-08-15 23:42:29
- starzabove
- Member

- Registered: 2004-04-13
- Posts: 76
Re: [plugin] [ORPHAN] zem_image_replace, version 2
I’ve tried in both IE6 and Firefox with the same results.
It shows the text, with the plug-in code change or not.
http://starzabove.com
I’ve messed with all sorts of CSS selectors and I don’t see what’s causing it to happen.
and even weirder is what it is doing here:
http://sternski.com
It’s clipping the images that it is generating?
I tried it on one other site, but had to return it to normal, and it’s doing the chopping off thing, too. After trying several adjustments, different fonts, etc. And all 3 sites are on the same server, and were checked in both IE6 and Firefox.
Thanks, again and again.
UPDATE-
I just tried it on still another site, and leaving the margin in there as
margin:0 0 0 -5000px;
does eliminate the text over-writing, but I’m still stuck with the right position.
I’m going to do some more CSS searching.
I did find another workaround, in CSS actually. I put this around the <code><txp:title /> tag
<span style=“font-size:2px;color:sameasbackgroundcolor;”><txp:title /></span></code>
I may have to go with such for now.
Last edited by starzabove (2004-08-15 23:51:53)
90+ Textpattern installs and still going…
Offline