OT? plpython2u

Поиск
Список
Период
Сортировка
От Nahum Castro
Тема OT? plpython2u
Дата
Msg-id CABqArLimjV5Binh33sw2C8EV=p_fJstrAj-OCR0+GT_MX-JhhA@mail.gmail.com
обсуждение исходный текст
Ответы Re: OT? plpython2u  (Jonathan Rogers <jrogers@socialserve.com>)
Re: OT? plpython2u  (Jonathan Rogers <jrogers@emphasys-software.com>)
Список psycopg
Hello all.

I need to process images on my database, they are stored on a bytea column.

The process consist on scaling and I have done this so far:

CREATE OR REPLACE FUNCTION  ajustar(randstring bytea)
RETURNS bytea AS
$$
    import PIL
    from PIL import Image
    basewidth = 300
    img = randstring
    wpercent = (basewidth/float(img.size[0]))
    hsize = int((float(img.size[1])*float(wpercent)))
    img = img.resize((basewidth,hsize), PIL.Image.ANTIALIAS)
   
    return img
$$
  LANGUAGE 'plpython2u' VOLATILE;


The objective of this pl is read the bytea from the database, scale, then replace the scaled image in the database, but I don't know  what type use to pass to the variable img.

This is the query.
update personal set foto=ajustar(encode(foto, 'hex')::bytea);

Thanks in advance.
Nahum





--
Nahum Castro González
Blvd. Perdigón 214, Brisas del Lago.
CP 37207
León, Guanajuato, México
Tel (477)1950304
Cel (477)1274694

В списке psycopg по дате отправления:

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Speeding up unicode decoding
Следующее
От: Jonathan Rogers
Дата:
Сообщение: Re: OT? plpython2u