Layering Text using image()

Author Message

Alex Jones

Tuesday 27 April 2004 2:45:49 pm

I am running into a brick wall with textoimage and could really use some help. What I am trying to do is layer two pieces of text, one on top of the other. I cannot set up the system to provide what I need.

<b>The Setup</b>
Top Layer: White, no background color
Bottom Layer: Brown with yellow background color. The text will be shifted one pixel left and one pixel down.

Basically, this will provide a thin border on the right and bottom of the text which will sit upon a solid background. But the system just won't generate this. It includes the background color of the top layer, blocking the bottom layer altogether. Assigning some transparency to the top layer doesn't have any affect. Here are the setting and the code I am using:

<b>From texttoimage.ini</b>
Bottom Layer:
[nav_header_layer_0]
Family=1942
Angle=0
XAdjustment=-4
YAdjustment=0
WidthAdjustment=4
HeightAdjustment=4
TextColor=#887766
BackgroundColor=#FFCC7F

Top Layer:
[nav_header_layer_1]
Family=1942
Angle=0
XAdjustment=4
YAdjustment=4
WidthAdjustment=4
HeightAdjustment=4
TextColor=#ffffff

<b>Template Code</b>

{image( $specialhead|texttoimage( 'nav_header_layer_0' ), 
        $specialhead|texttoimage( 'nav_header_layer_1' ) ) }

$specialhead contains the text to be transformed and works properly. I have checked that both nav_header_layer_0 and nav_header_layer_1 can generate an image on their own, so the problem definitely comes in the layering.

FYI, I am using GD2, not ImageMagick.

Any help would truly be appreciated!

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Björn [email protected]

Tuesday 27 April 2004 4:08:16 pm

here is some code that works

{image(concat($sitename,' ',$siteslogan),imagefile('logo_blank.png'|ezimage(no)|remove(0,1)),array($sitename|texttoimage('logo'),hash(transparency,0,halign,left,valign,top)),array($siteslogan|texttoimage('logoslogan'),hash(transparency,0,halign,left,valign,top)))}

but when ever I try to add a second one my apache crashed (Windows,apache2)

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Alex Jones

Wednesday 28 April 2004 6:48:41 am

Thanks Björn, I'll try to use yoru code as a starting point. :)

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alex Jones

Wednesday 28 April 2004 8:42:04 am

Well, I am closer than I was thanks to Björn's help, but the result is not quite perfect. I'm really really close though. :) I am now using:
<b>From texttoimage.ini.append</b>
[nav_header_layer_0]
Family=palab
TextColor=#ffffff
BackgroundColor=#FFCC7F

[nav_header_layer_1]
Family=palab
TextColor=#807360
BackgroundColor=#FFCC7F

With this code:

{image( array($specialhead|texttoimage('nav_header_layer_0'), hash(transparency,0,halign,left,valign,top)),
        array($specialhead|texttoimage('nav_header_layer_1'), hash(transparency,0.9,halign,left,valign,top,x,2,y,2)) ) }

But, what I would really like to figure out is how to tell the system to not apply any background color to <i>nav_header_layer_0</i>. If I do not specify the background color it automatically applies a white background which makes the entire image faded. Ideally, I want the background color to be set by <i>nav_header_layer_1</i> which also assigns the text color for the offset (like a shadow). Then <i>nav_header_layer_0</i> should only apply a top layer using white text without any background color.

For a visual check out http://www.silverspider.com/layered_text_example.gif
The top box shows the effect I want to achieve - please ignore the small caps for now - that's another question ;)
The second box shows <i>nav_header_layer_0</i>
The third box shows <i>nav_header_layer_1</i>
The final box shows the result of the above code, merging <i>nav_header_layer_0</i> with <i>nav_header_layer_1</i>.

Notice that in the final box the white text is dulled by the fact that the layer has to be somewhat transparent to allow the brown text behind to show through. Also notice that the brown text isn't as strong as it should be, due to the background color applied by the top layer.

Any ideas?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.