Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple DataUploadEvent from ImageAddition #1003

Open
shish opened this issue Jan 9, 2024 · 2 comments
Open

Decouple DataUploadEvent from ImageAddition #1003

shish opened this issue Jan 9, 2024 · 2 comments
Labels

Comments

@shish
Copy link
Owner

shish commented Jan 9, 2024

Upload -> DataUpload -> Unzip -> Transcode -> Sanitise -> ImageAddition / ImageReplace are all tied in knots together, it'd be nice if they weren't

@shish
Copy link
Owner Author

shish commented Jan 9, 2024

A bunch of sleep-deprived changes have half-un-knotted this, but also mean that ImageAddition and ImageReplace are now separate workflows -- ImageAddition gets the Transcode & Sanitize steps but ImageReplace doesn't. We should make those two steps more generic so that they can be easily used from both Addition and Replace, without needing to merge Addition and Replace into one thing.

@shish shish added the Feature label Jan 9, 2024
@shish
Copy link
Owner Author

shish commented Jan 9, 2024

Similar to DataHandlerExtension:

class DataFilterEvent {
    $file = "...";
}

onDataFilter($event) {
    if(this->cares_about($event->file)) {
         // stop this DataFilter
        $event->stop();
        // transcode to a new file
        $tmpfile = mktemp();
        transcode($event->file, $tmpfile);
        unlink($event->file);
        // start a new DataFilter with the new file
        $subevent = send_event(new DataFilter($tmpfile));
        // return the final file in the chain
        $event->file = $subevent->file;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant