2015-12-22 100 views
0

我想在将上传的图片插入数据库之前将其大小缩小到合适的大小。在插入之前触发处理ORDImage

在Apex中,我创建了一个允许用户上传文件的简单表单,并设置了以下触发器。

create or replace TRIGGER new_post 
    BEFORE INSERT 
    ON posts 

FOR EACH ROW 

BEGIN 
    --l_image := ORDSYS.ORDImage.Init(); 
    --SELECT image INTO l_image FROM posts WHERE posts.post_id = :old.post_id FOR UPDATE; 
    ORDSYS.ORDImage.process(:new.image, 'maxscale=200 200'); 

    :new.user_id := v(':APP_USER'); 
END; 

这编译正常,但当我尝试并上传产生以下错误的图像:

1 error has occurred 

ORA-29400: data cartridge error 
IMG-00730: unable to process empty image 
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 75 
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 65 
ORA-06512: at "ORDSYS.ORDIMERRORCODES", line 29 
ORA-06512: at "ORDSYS.ORDIMG_PKG", line 121 
ORA-06512: at "ORDSYS.ORDIMAGE", line 1366 
ORA-06512: at "MATTHEWLAWS.NEW_POST", line 4 
ORA-04088: error during execution of trigger 'MATTHEWLAWS.NEW_POST' 

我要去哪里错了?

我还想创建另一个缩略图放在同一张表中。

回答