Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.3k views
in Plugins by

Hi all, for a new plugin I am devleoping I thought I could catch the image upload somehow. My plugin needs to collect all Blobids from all uploaded files this day, though, I am think about a mysql workaround now. Nevertheless, the question is quite interesting for developers and upcoming plugins.

Each editor uses a URL for the upload. So I could look for the matching request like that:

        function match_request($request)
        {
            return ($request=='sceditor-upload'); // or another editor URL
        }
 

Problem is that each plugin has another $request URL. So using my plugin I do not know what the editor URL is and cannot catch the upload "event".

Any idea how to overcome this?

Thanks,
Kai

 

For reference: http://www.question2answer.org/modules.php

Q2A version: 1.6.3

1 Answer

+1 vote
by
edited by
I am also working to add more custom events .

For now I think you can override qa_create_blob (in qa-app-blobs.php line 66) and qa_db_blob_create (in qa-db-blobs.php line 33)

Then you can use qa_report_event to report any custom events with any additional data.

Hope it may be helpful.
by
Nice idea, I didn't think of that :)
by
edited by
But if you're talking about editors then you mean uploading from situations in which you are posting. Those functions handle all blob creations, not only the ones for posts. EG: Uploading an avatar.
by
I think there may be some workrounds. He can test other events like q_post in some places.
...