its better to keep the TemporaryFile so that the image filesize gets
updated, otherwise the image filesize will be the same as the original and
it should be smaller
On Thursday, September 2, 2010 12:30:49 PM UTC+1, kachna wrote:
>
> One more update. "tempfile.TemporaryFile()" in not needed.
>
>
One more update. "tempfile.TemporaryFile()" in not needed.
def __call__(self, value):
import Image
import cgi
try:
im = Image.open(value.file)
print im.size, im.format
Thanks for hint.
Here is my working solution. It takes lot of time.
def __call__(self, value):
import Image
import cgi
import tempfile
try:
im = Image.open(value.file)
print im
not 100% thread safe but ok in most of the cases.
On Sep 1, 5:57 pm, Jose wrote:
> What I did was the following:
> 1) upload image
> 2) resize the image on the server
>
> if form.accepts(request.vars, session):
> import os
> import my_module_resize
>
> id = form.vars.id
>
What I did was the following:
1) upload image
2) resize the image on the server
if form.accepts(request.vars, session):
import os
import my_module_resize
id = form.vars.id
row= mytable[id]
path = os.path.join(os.getcwd(), 'applications', 'myapp',
'uploads',
This is a bit more complex than it seems because upload expects a
ci.FieldStorage object so the validator __call__ should return a
cgi.FieldStoarge.
On Sep 1, 3:50 pm, kachna wrote:
> Hi,
> I am trying to write validator to resize my image before storing in DB
> field.
>
> class RESIZE_IMG(object
6 matches
Mail list logo