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 Dieding@xrow.de

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.

eZ debug

Timing: Jan 18 2025 19:34:57
Script start
Timing: Jan 18 2025 19:34:57
Module start 'layout'
Timing: Jan 18 2025 19:34:57
Module start 'content'
Timing: Jan 18 2025 19:34:58
Module end 'content'
Timing: Jan 18 2025 19:34:58
Script end

Main resources:

Total runtime1.1675 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.0469152.6250
Module start 'layout' 0.00630.0034 741.671939.4453
Module start 'content' 0.00961.1562 781.1172572.8203
Module end 'content' 1.16590.0015 1,353.937516.1641
Script end 1.1674  1,370.1016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2800160.0002
Check MTime0.00130.1138160.0001
Mysql Total
Database connection0.00080.065710.0008
Mysqli_queries1.100294.2395600.0183
Looping result0.00060.0538580.0000
Template Total1.133597.120.5667
Template load0.00220.186120.0011
Template processing1.131396.902420.5656
Template load and register function0.00010.008310.0001
states
state_id_array0.00120.099210.0012
state_identifier_array0.00260.222020.0013
Override
Cache load0.00190.1649670.0000
Sytem overhead
Fetch class attribute can translate value0.00070.058120.0003
Fetch class attribute name0.00120.098660.0002
XML
Image XML parsing0.00100.082320.0005
class_abstraction
Instantiating content class attribute0.00000.001680.0000
General
dbfile0.00090.0764220.0000
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs