[Zope] TTImage improvement (code)

Andreas andreas@aHIT.de
Sun, 05 Mar 2000 01:57:10 -0700


Many thanks to Michael the author of TTImage
for pubishing your Product at zope.org.
You did a great job !

In order to create TTImage instances within DTML-Documents I made
some changes on TTImageClass_add because I got errors due to
empty BasicProps and DestinationURL.
Would be nice if you could include it in your next release.

I´m new with Python and especially with PIL so at the moment it´s 
not so easy for me to fix some further problems with the background
color.
When I set the backgroung color to 0xffffff the background color of the 
result is 0xfcfcfc ... seems to be an color palette problem ...   

Also I was wondering if it is possible to set the background to
transparent ?

I look forward to hearing your thoughts on my changes :-)

regards 
Andreas Heckel

#### TTImageClass_add #####

<HTML>
<HEAD><TITLE>Add TTImageClass</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<dtml-call "REQUEST.set('file','')">
<dtml-unless "_.has_key('text')">
  <dtml-call "REQUEST.set('text','Hello')"></dtml-unless>
<dtml-unless "_.has_key('font_size')">
  <dtml-call "REQUEST.set('font_size',24)"></dtml-unless>
<dtml-unless "_.has_key('font_face')">
  <dtml-call "REQUEST.set('font_face','times')"></dtml-unless>
<dtml-unless "_.has_key('resolution_x')">
  <dtml-call "REQUEST.set('resolution_x',72)"></dtml-unless>
<dtml-unless "_.has_key('resolution_y')">
  <dtml-call "REQUEST.set('resolution_y',72)"></dtml-unless>
<dtml-unless "_.has_key('fixed_width')">
  <dtml-call "REQUEST.set('fixed_width',0)"></dtml-unless>
<dtml-unless "_.has_key('fixed_height')">
  <dtml-call "REQUEST.set('fixed_height',0)"></dtml-unless>
<dtml-unless "_.has_key('background_color')">
  <dtml-call "REQUEST.set('background_color','0xffffff')"></dtml-unless>
<dtml-unless "_.has_key('foreground_color')">
  <dtml-call "REQUEST.set('foreground_color','0x000000')"></dtml-unless>
<dtml-unless "_.has_key('font_encoding')">
  <dtml-call "REQUEST.set('font_encoding','UNICODE')"></dtml-unless>
<dtml-unless "_.has_key('text_encoding')">
  <dtml-call "REQUEST.set('text_encoding','LATIN2')"></dtml-unless>
<dtml-unless "_.has_key('format')">
  <dtml-call "REQUEST.set('format','GIF')"></dtml-unless>

<dtml-with "TTImageClass.createInObjectManager(REQUEST['id'], REQUEST)">
 <dtml-call "propertysheets.BasicProps.manage_editProperties(REQUEST)">
 <dtml-call render_text>
</dtml-with>

<dtml-unless NoRedir>
  <dtml-if DestinationURL>
    <dtml-call "RESPONSE.redirect(DestinationURL+'/manage_workspace')">
  <dtml-else>
    <dtml-call "RESPONSE.redirect(URL2+'/manage_workspace')">
  </dtml-if>
</dtml-unless>

</body></html>