20210904 - 이미지 변환을 위한 cloudinary 통합

1. 이미지 업로드 구현 Oracle Object Storage

Form 리전에 Page Item 추가

Identification - Type : File Browse...




Processing - Processes 추가


declare
  l_request_url varchar2(32767);
  l_content_length number;

  l_response clob;
    
  upload_failed_exception exception;
begin

  if :P55_STORE_ID is null then return; end if;
  if :P55_PROD_ID is null then return; end if;

  for file in (
    select * from apex_application_temp_files
    where name = :P55_FILE
  ) loop
    l_request_url := 'https://objectstorage.ap-seoul-1.oraclecloud.com'||.....|| 
apex_util.url_encode(file.filename);

    apex_web_service.g_request_headers(1).name  := 'Content-Type';
    apex_web_service.g_request_headers(1).value := file.mime_type;
    l_response := apex_web_service.make_rest_request(
      p_url => l_request_url
      , p_http_method => 'PUT'
      , p_body_blob => file.blob_content
      , p_credential_static_id => '#CREDENTIAL NAME#'
    );

    if apex_web_service.g_status_code != 200 then
      raise upload_failed_exception;
    end if;

    update x21091_store_prod 
       set imgpath = l_request_url
     where prod_id = :P55_PROD_ID;

  end loop;
end;



** 파일 업로드 프로세스 구현시 우측 속성의 Editable Region 을 선택 해제해야 코드 작성 가능했음

2. cloudinary.com 가입 후 key 생성, 업로드 구현

3. cloudinary 업로드 후 자동 변환 설정

c_fill,g_auto,h_300,w_400


결과적으로는 Oracle Object Storage 에는 원본 저장

cloudinary 는 복제 후 사이즈 변환된 이미지 저장하여 사용자에게 보여 줄 때는 작은 사이즈로 보여줌.




참고

https://cloudinary.com/

https://cloudinary.com/documentation/image_transformations

https://blogs.oracle.com/apex/post/forms-in-apex-191-more-power-more-flexibility

https://squarelab.co/blog/get-started-with-cloudinary/

https://webdir.tistory.com/487



 

댓글 없음:

댓글 쓰기

20250202 - IG 다운로드 버튼 바로 보이기

JS initialization Code : function (config) {     var $ = apex.jQuery,         toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),  ...