Skip to Main Content
Feature Request FR-4601
Product Area APIs
Status ROADMAP

10 Voters

Handling Base64 images using APEX_WEB_SERVICE.CLOBBASE642BLOB

pmushkov Public
· Aug 12 2025

Idea Summary
Automatically remove the header part of Base64 encoded images if such exists  data:image/png;base64,iVBORw0KG.… - in this example the data:image/png;base64,

Use Case
Very common use of APEX_WEB_SERVICE.CLOBBASE642BLOB is transforming Base64 encoded images into BLOBs. My experience shows that blobs get created corrupt (but without raising any error) if the header is included in the string. That's why currently I have to manually remove it before using the function to avoid bad blobs being created.

Preferred Solution (Optional)
If header of the Base64 string is present - trim it:
REGEXP_REPLACE(:P1_BASE64_IMG, '^data:[^;]+;base64,',‘’)

for example:

case when REGEXP_LIKE(:P1_BASE64_IMG, ‘^data:[^;]+;base64,’) 
 then  REGEXP_REPLACE(:P1_BASE64_IMG, ‘^data:[^;]+;base64,’,‘’) --exists, trim it 
 else  :P1_BASE64_IMG --not exists, leave it as is
end check_base64
This is currently on the roadmap for a future release of Oracle APEX.

Comments

Comments

  • angel o. flores t. OP 3 weeks ago

    Maybe its time to create dedicated package APIs, for manipulating images, like apex_image.image_to_base64, or apex_image.base64_to_image