Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 1830

Extension Writers Discussion • [Split] Modifying post data

$
0
0
Hi, instead of creating a new post, this one seems to be a good place for me to ask this.

I'm using an extension that enables the CKEditor to be used as the post editor. When a user drags a jpg onto the editor, CKeditor (or someone, I haven't figured out who), is inserting an img tag like this:

Code:

[img]data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4ZkSRXhpZgAATU0AKgAAAAgAEAEAAAQAAAABAAAPwAEBAAQAAAABAAAL0AEPAAIAAAAHAAA...[/img]
My board has a custom image store / upload facility that will let me take that base64 encoded data and write it as a .jpg file with an Internet accessible url, e.g. https://photos.myforum.org/<unique photo id>.jpg.

I want to trap post submit, save the base64 data as a file named `<unique photo id>.jpg` and modify the img tag above to be:

Code:

[img]https://photos.myforum.org/<unique photo id>.jpg[/img]
This will enable a pretty nice photo upload capability for users.

I am trying to find docs on text_formatter_s9e_configure_after and parsers but can't find enough to really help me understand how to make this work. The closest I've found is this https://s9etextformatter.readthedocs.io ... Unparsing/

I have this code in place, ready to fill in:

Code:

    static public function getSubscribedEvents()    {        return array(            'core.text_formatter_s9e_configure_after'   => 'convert_img_data_to_upload'        );    }    public function convert_img_data_to_upload($event)    {        $configurator = $event['configurator'];        ...    }
I'd really appreciate some pointers that will help me replace the ... above with something that lets me

- get the contents of each img tag
- replace the contents of each img tag

Thanks.

Statistics: Posted by tig_ — Wed Jan 08, 2025 5:10 pm



Viewing all articles
Browse latest Browse all 1830

Trending Articles