[OJS 3.3] Custom theme: How to add a field to upload an image?

In my custom theme I would like to add an optional field to upload an additional image.
I would like to understand how to do it for both journals and the main site.

I think I have to do:

$this->addOption('my_new_option_name','FieldUploadImage',array(...))

So what to put in place of “…”?

Hi @eniocarboni,

Unfortunately, addOption method doesn’t support file uploads: pkp-lib/ThemePlugin.inc.php at b92e3ea9cc773d9a602b17aeaf8a4280a5bf029a · pkp/pkp-lib · GitHub. Thus, to implement this approach would be quite tricky - overring the method from a theme and implement all the background logic.
Depending on the task, the easier solution would be hardcode it in the template or the text option that is expecting URL pointing to the image.

Hi @Vitaliy ,
in function init() I do:
$request = Application::get()->getRequest();
$dispatcher = $request->getDispatcher();
$temporaryFileApiUrl = $dispatcher->url($request, ROUTE_API, CONTEXT_ID_ALL, ‘temporaryFiles’);

So then
$this->addOption(‘my_new_option_name’,‘FieldUploadImage’,array(
‘label’ …

‘options’ => [
‘url’ => $temporaryFileApiUrl,
]
))
At this point I have the upload field working.
After the upload, the image file is deposited in the temporary area which I would not know how to move to the public area.