473,513 Members | 13,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PIL + Zope + resizing images

KK
Hallo.

I have Zope 2-7-0 on Linux platform and the following problem :)
I'm sending an image through form on the pythonScript. I want script to
resize image and save on the zope folder in 3 different size. OK, I use
ExternalMethod which uses PIL library to resize these images.

External method:
def xImageScale(img_file, maxx, maxy):
from PIL import Image
from cStringIO import StringIO
im = Image.open(img_file)
im.thumbnail((maxx, maxy), Image.ANTIALIAS)
out_file_str = StringIO()
im.save(out_file_str, im.format)
out_file_str.seek(0)
tmp=out_file_str.read()
out_file_str.close()
return tmp
pyrthonScript:
cAnimation = form.get('cAnimation','') # image from the form
if cAnimation:
o.invokeFactory(id='cAnimationS.'+timeStamp, type_name='Image',
file=context.xImageScale(cAnimation, 100, 100)
o.invokeFactory(id='cAnimationM.'+timeStamp, type_name='Image',
file=context.xImageScale(cAnimation, 200, 200)
o.invokeFactory(id='cAnimationB.'+timeStamp, type_name='Image',
file=context.xImageScale(cAnimation, 300,300)
The result is "IOError, cannot identify image file". So, when I want to
resize and save only one image it works properly.
Thanks in advance for any help
KK
Jul 18 '05 #1
0 1284

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
5037
by: lawrence | last post by:
Can someone please tell me where I can get some open source code for resizing images? I know such code has been written a million times and I don't feel like doing it again from scratch.
2
2680
by: Alex Hopson | last post by:
I'm using the code below to loop through some images and resize each image twice, once to create a thumbnail and once to create a small image. The page stops loading around the 38th image out of...
21
1580
by: godwin | last post by:
Hi all, I wanna thank Martin for helping out with my ignorance concerning execution of stored procedure with python. Now i have decided to write a web app that googles into my companies...
10
2291
by: riki | last post by:
Hi, i have a big problem...i'm using one jscript for resizing of all of my pics in popUp...in main html i'm having many little pics and clicking on them they open in popUp and resize to larger...
13
6866
by: Jon Yeager | last post by:
I need to display a bunch of pictures that are all of various dimensions into a fixed dimension space, like MSN Messenger does with its user photos in the chat windows. Forcing image dimensions...
5
4720
by: Jim | last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick) is a processor intensive exercise. I'm setting up a site where users will be uploading up to 10 images along with the details...
1
2113
by: Ron Vecchi | last post by:
I am using asp.net to upload an image and then perform resizing on it and saving the different sizes to file. The resized images were coming up and being displayed in the bowser fine but the image...
6
2254
by: tomasio | last post by:
Dear NG, years have passed and I am still more designer than programmer. I build a new version of my website which has a few nasty bugs, especially on my startpage: Resizing text brakes the...
10
7043
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.