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:
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:
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:
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.
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]
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]
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']; ... }
- 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