Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REPORT zdemo_igs.
- DATA: lv_path TYPE string,
- photo_out TYPE string,
- lv_str TYPE string,
- lv_handle TYPE i,
- lv_buff TYPE xstring,
- lv_len TYPE i,
- lt_bin TYPE sdokcntbins,
- image_processor TYPE REF TO cl_fxs_image_processor.
- lv_str = 'C:\temp\photo\photo_big.jpg'.
- photo_out = 'C:\temp\photo\photo_small.jpg'.
- CALL METHOD cl_gui_frontend_services=>gui_upload
- EXPORTING
- filename = lv_str
- filetype = 'BIN'
- IMPORTING
- filelength = lv_len
- CHANGING
- data_tab = lt_bin
- EXCEPTIONS
- OTHERS = 1.
- IF sy-subrc <> 0.
- ENDIF.
- CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
- EXPORTING
- input_length = lv_len
- IMPORTING
- buffer = lv_buff
- TABLES
- binary_tab = lt_bin
- EXCEPTIONS
- failed = 1
- OTHERS = 2.
- IF sy-subrc <> 0.
- ENDIF.
- CREATE OBJECT image_processor.
- TRY.
- lv_handle = image_processor->add_image( lv_buff ).
- CATCH cx_root.
- ENDTRY.
- TRY.
- CALL METHOD image_processor->resize
- EXPORTING
- iv_handle = lv_handle
- iv_xres = 1024
- iv_yres = 768
- EXCEPTIONS
- OTHERS = 1.
- IF sy-subrc = 0.
- lv_buff = image_processor->get_image( lv_handle ).
- ELSE.
- "smth
- ENDIF.
- CATCH cx_root.
- "smth
- ENDTRY.
- CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
- EXPORTING
- buffer = lv_buff
- IMPORTING
- output_length = lv_len
- TABLES
- binary_tab = lt_bin.
- lv_str = photo_out.
- CONDENSE lv_str.
- CALL METHOD cl_gui_frontend_services=>gui_download
- EXPORTING
- bin_filesize = lv_len
- filename = lv_str
- filetype = 'BIN'
- CHANGING
- data_tab = lt_bin
- EXCEPTIONS
- OTHERS = 1.
- IF sy-subrc <> 0.
- ENDIF.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement