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: Select all
[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: Select all
[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: Select all
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.