2015-12-22 143 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' 

我要去哪裏錯了?

我還想創建另一個縮略圖放在同一張表中。

回答