---
title: "Discussion on \"CKEditor5 Image Upload - Additional thoughts\" | Hashnode"
description: "Discussion on \"CKEditor5 Image Upload - Additional thoughts\". Introduction\nAfter publishing an article on CKEditor5 Image Upload, I received a comment from Stefan Dobre from the Oracle APEX team that made me think about how to handle image uploads in a more clever way:\n\nAnd a couple more things that you may sti..."
url: "https://hashnode.com/posts/ckeditor5-image-upload-additional-thoughts/62dfdeb58730728f62e8e4bf"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [CKEditor5 Image Upload - Additional thoughts](https://lmoreaux.hashnode.dev/ckeditor5-image-upload-additional-thoughts?utm_source=hashnode&utm_medium=feed)

Introduction After publishing an article on CKEditor5 Image Upload, I received a comment from Stefan Dobre from the Oracle APEX team that made me think about how to handle image uploads in a more clever way: And a couple more things that you may sti...

Jul 26, 2022 · 5 min read · lmoreaux.hashnode.dev  
Read the article

-   [#orclapex](https://hashnode.com/tag/orclapex)
-   [#oracle](https://hashnode.com/tag/oracle)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#plsql](https://hashnode.com/tag/plsql)

## Written by

[Louis Moreaux](https://hashnode.com/@lmoreaux)

@lmoreaux · Paris

  
[View profile](https://hashnode.com/@lmoreaux)

Oracle APEX developer

Oracle APEX Developer (Insum) from Paris Contributor of Flows for APEX Passionate about APEX and web development.

## Responses 2

Markdown supported · ⌘↵ to post

[Yuji Nakakoshi](https://hashnode.com/@ynakakoshi)

[Aug 4, 2022](https://hashnode.com/posts/ckeditor5-image-upload-additional-thoughts/62dfdeb58730728f62e8e4bf/comment/62eb2fce16f9480a9dac7300)

Thank you Louis, your article inspires me a lot.

Because I tried to implement the image upload before this wrap-up, I took some different implementation. Let me share.

Firstly the content of CKEditor stores in APEX Collection then copied to the table after Automatic-DML process by the code below.

Text is stored in CKE\_DOCUMENTS.CONTENT and CKE\_IMAGES.DOCUMENT\_ID is referring CKE\_DOCUMENTS.ID.

```
declare
    l_clob clob;
    l_link varchar2(32767);
    l_id varchar2(80);
    i pls_integer;
    l_images apex_t_varchar2;
begin
    select clob001 into l_clob
    from apex_collections where collection_name = :P2_COLLECTION and seq_id = 1;
    update cke_documents set content = l_clob where id = :P2_ID;
    -- find all image url from the content.
    i := 1;
    while true
    loop
        -- retrieve the image url with the id
        l_link := regexp_substr(l_clob, :G_IMAGE_URL || '/([0-9]+)',1,i);
        if l_link is null then
            exit;
        else
            i := i + 1;
            -- get image id from the url and remember it.
            l_id := regexp_replace(l_link, :G_IMAGE_URL || '/([0-9]+)', '\1');
            apex_string.push(l_images,l_id);
        end if;
    end loop;
    -- initialize the images linked to the document, no effect on new doc.
    update cke_images set document_id = null where document_id = :P2_ID;
    -- link image to the document.
    update cke_images set document_id = :P2_ID where id in (select column_value from table(l_images));
end;
```

Since cascade delete is enabled, any images linked to the document will be deleted along with the document. Images may remain, but housekeeping is simple (just delete the image without document\_id).

[Louis Moreaux](https://hashnode.com/@lmoreaux)

[Aug 4, 2022](https://hashnode.com/posts/ckeditor5-image-upload-additional-thoughts/62dfdeb58730728f62e8e4bf/comment/62eb2fce16f9480a9dac7300#reply-62ebd352f583cc2636e533ba)

Thank you for the comment Yuji and for sharing the solution you are using. This is awesome!

[Jon Dixon](https://hashnode.com/@orclapex)

[Jul 26, 2022](https://hashnode.com/posts/ckeditor5-image-upload-additional-thoughts/62dfdeb58730728f62e8e4bf/comment/62dfe0b6790e138f3d399693)

Love it; excellent follow-up Article!

[Louis Moreaux](https://hashnode.com/@lmoreaux)

[Aug 4, 2022](https://hashnode.com/posts/ckeditor5-image-upload-additional-thoughts/62dfdeb58730728f62e8e4bf/comment/62dfe0b6790e138f3d399693#reply-62ebd274cbce7c268014da47)

Thanks Jon!
