Re: [Zope] Re: [Image-SIG] Properly integrating PIL, reportlab, and zope

2000-11-09 Thread ed colmar


Ahha!

To force zope (and reportlab) to use a different working directory, use:

import os
os.chdir('/usr/local/zope/differentdir/')

still this is a pretty big workaround, but hey...  It works!

-e-


 Hello ed,

 If you figure this out let me know. We tried several times and were
 unsuccessful. we only have two files (logos) so it wasn't worth fighting
 with.

 thanks,

 Dan


 ed colmar wrote:
 
  Thanks for the help everyone!
 
  I'm a few steps closer to solving this one.  What I'm doing is pretty
much a
  workaround, since I can't figure out how to pass a image file directly
from
  within the zodb.  I have created a seperate field that gets passed to a
  localFS directory.
 
  Right now, I just need to refrence a file that is somewhere other than
the
  /usr/local/zope directory.
 
  I've been trying:
  c.drawInlineImage(str('/home/zope/uploadedimages/' + filename), .5*inch,
  10.*inch,4*inch)
 
  for some reason it can't find a file anywhere other than the base
directory
  in zope.  I cannot use this directory because it will serve as a
collection
  of image files.
 
  Any ideas how to force it to look somewhere else for this file?
 
  Thanks again!
 
  -e-
 
  - Original Message -
  From: "Daniel Rusch" [EMAIL PROTECTED]
   I have no idea if this will help you. We use PIL, reportlabs and zope
to
   create P.O.'s, to place a logo on the page we use the following line
of
   code:
  
   c.drawInlineImage("gclogo_color.gif", .5*inch, 10.*inch,4*inch)
  
 
  ___
  Zope maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists -
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope-dev )



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Re: [Image-SIG] Properly integrating PIL, reportlab, and zope

2000-11-08 Thread ed colmar


Thanks for the help everyone!

I'm a few steps closer to solving this one.  What I'm doing is pretty much a
workaround, since I can't figure out how to pass a image file directly from
within the zodb.  I have created a seperate field that gets passed to a
localFS directory.

Right now, I just need to refrence a file that is somewhere other than the
/usr/local/zope directory.

I've been trying:
c.drawInlineImage(str('/home/zope/uploadedimages/' + filename), .5*inch,
10.*inch,4*inch)

for some reason it can't find a file anywhere other than the base directory
in zope.  I cannot use this directory because it will serve as a collection
of image files.

Any ideas how to force it to look somewhere else for this file?

Thanks again!

-e-



- Original Message -
From: "Daniel Rusch" [EMAIL PROTECTED]
 I have no idea if this will help you. We use PIL, reportlabs and zope to
 create P.O.'s, to place a logo on the page we use the following line of
 code:

 c.drawInlineImage("gclogo_color.gif", .5*inch, 10.*inch,4*inch)



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Re: [Image-SIG] Properly integrating PIL, reportlab, and zope

2000-11-01 Thread Daniel Rusch

I have no idea if this will help you. We use PIL, reportlabs and zope to
create P.O.'s, to place a logo on the page we use the following line of
code:
 
c.drawInlineImage("gclogo_color.gif", .5*inch, 10.*inch,4*inch)

where c is created thusly:
c = canvas.Canvas(fileName,(PAGE_WIDTH*inch,PAGE_LENGTH*inch),
pageCompression=0)

HTH,

Dan


ed colmar wrote:
 
 Hi all!
 
 I am working on a project using zope and reportlab.
 
 The goal is to have uploaded images end up in a formatted PDF file.
 
 I have both of these halves completed, I need to figure out how to connect
 them.
 
 I have been using SquishFile.py as the wrapper around uploaded images, as is
 done in squishdot.  The few image types I have tried have displayed fine on
 screen, but PIL is not able to recognise the image.
 
 How would you go about wrapping the file in a PIL.Image() ?  I've been
 trying things similar to:
 
 cardimage=PIL.Image.open(self.uploadedimage)
 c.drawInlineImage(cardimage, 1,1)
 
 This gives an error in reportlab.canvas.convert()
 
 I tried using PIL.image.fromstring(), but I can't quite get the it to work
 out:
 
 filebytes=[str(self.uploadedimage.file_bytes()), 'bytes']
 cardimage=PIL.Image.fromstring(self.uploadedimage.content_type(),
filebytes,
self.uploadedimage.file_data())
 c.drawInlineImage(cardimage, 1,1)
 
 This gives a typeerror: PIL/Image.py, line 848, in new
 
 has anyone succesfully done this?  can I just Leave the SquishFile wrapper
 off if it is ONLY going to be images that get uploaded?
 
 Thanks for any ideas!
 
 -ed-
 
 ___
 Image-SIG maillist  -  [EMAIL PROTECTED]
 http://www.python.org/mailman/listinfo/image-sig

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )