[Zope] PIL Question

J. Joy kyroraz@yahoo.com
Sun, 12 May 2002 00:49:24 -0700 (PDT)


--0-1142391128-1021189764=:66675
Content-Type: text/plain; charset=us-ascii


 
  Ross Lazarus <do_not_reply_to_this@bellatlantic.net> wrote: 
the img tag expects the server to deliver an existing image file from 
somewhere. What you need to do is a little more complex (!). You COULD 
write the image into a zope object (bad idea for lots of reasons - eg 
zodb bloat) or to a localFS (better but still sucky) and deliver it from 
there using an img tag. AFAIK, this is the ONLY way to embed your image 
into a page with text and stuff.


This is not a problem.  In the HTML example of how this is called, I may not have shown 
clearly enough that what I want to do is have the src be an object in the same folder that
would generate this image upon calling it and the external python method would generate
and return the image back.  The part that I am having trouble with is with the return part of
my external method.  I do not know how to make it return the data of the image that was just
generated.  I can save it to a file, but I can't find a nice way of returning the image data back
from the call.  I searched for a few hours to try to find some practical examples of perhaps
how to do this on google, but nothing came up.  

To wit, the External Call should act like a image when referenced, it's just having "stuff" passed to
it to form the image in question. :)

The External Call would be called like:

&lt;img src="MakeImage"&gt;

Where MakeImage would be the External Method.


> 
> I'm trying to create an external method that will take variables that exist in a ZSQL call and will output an image
> 
> based on that: 
> 
> import Image, ImageDraw, StringIO, os.path
> 
> def PILtest():
> image = Image.new('RGB',[25,25])
> ## IMage Stuff Happens here!
> return image
> 
> Where this would occur in a DTML-Method of:
> 
> 

>  
> 
> 
> But I can't get PILtest to output the image itself. Save() doesn't seem to be of help directly. Anyone have any suggestions?
> 
> Jason




---------------------------------
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
--0-1142391128-1021189764=:66675
Content-Type: text/html; charset=us-ascii

<P> 
<P>&nbsp; <B><I>Ross Lazarus &lt;do_not_reply_to_this@bellatlantic.net&gt;</I></B> wrote: 
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<P>the img tag expects the server to deliver an existing image file from <BR>somewhere. What you need to do is a little more complex (!). You COULD <BR>write the image into a zope object (bad idea for lots of reasons - eg <BR>zodb bloat) or to a localFS (better but still sucky) and deliver it from <BR>there using an img tag. AFAIK, this is the ONLY way to embed your image <BR>into a page with text and stuff.<BR></P></BLOCKQUOTE>
<P>This is not a problem.&nbsp; In the HTML example of how this is called, I may not have shown <BR>clearly enough that what I want to do is have the src be an object in the same folder that<BR>would generate this image upon calling it and the external python method would generate<BR>and return the image back.&nbsp; The part that I am having trouble with is with the return part of<BR>my external method.&nbsp; I do not know how to make it return the data of the image that was just<BR>generated.&nbsp; I can save it to a file, but I can't find a nice way of returning the image data back<BR>from the call.&nbsp; I searched for a few hours to try to find some practical examples of perhaps<BR>how to do this on google, but nothing came up.&nbsp; </P>
<P>To wit, the External Call should act like a image when referenced, it's just having "stuff" passed to<BR>it to form the image in question. :)</P>
<P>The External Call would be called like:</P>
<P>&amp;lt;img src="MakeImage"&amp;gt;</P>
<P>Where MakeImage would be the External Method.</P>
<P><BR>&gt; <BR>&gt; I'm trying to create an external method that will take variables that exist in a ZSQL call and will output an image<BR>&gt; <BR>&gt; based on that: <BR>&gt; <BR>&gt; import Image, ImageDraw, StringIO, os.path<BR>&gt; <BR>&gt; def PILtest():<BR>&gt; image = Image.new('RGB',[25,25])<BR>&gt; ## IMage Stuff Happens here!<BR>&gt; return image<BR>&gt; <BR>&gt; Where this would occur in a DTML-Method of:<BR>&gt; <BR>&gt; <DTML-IN SQL_COMMAND><BR>&gt; <IMG src="http://us.f149.mail.yahoo.com/ym/PILtest"> <!--vars to be passed in with this--><BR>&gt; </DTML-IN><BR>&gt; <BR>&gt; But I can't get PILtest to output the image itself. Save() doesn't seem to be of help directly. Anyone have any suggestions?<BR>&gt; <BR>&gt; Jason<BR></P><p><br><hr size=1><b>Do You Yahoo!?</b><br>
<a href="http://rd.yahoo.com/welcome/*http://launch.yahoo.com">LAUNCH</a> - Your Yahoo! Music Experience
--0-1142391128-1021189764=:66675--