Search

(Housekeeper: forked this from the Mediathek 2 field to keep things on-topic)

Just want to make a suggestion, I think it’d be a good idea to include a delegate in every field that performs an upload so that image processing can be done separately from the fields:

<?php

    ###
    # Delegate: ModifyUploadedFile
    # Description: Allows processing of files that have just been uploaded.
    $this->_engine->ExtensionManager->notifyMembers(
        'ModifyUploadedFile', '/backend/',
        array(
            'filename'      => '',  // Exact path to uploaded file
            'section_id'    => 0,   // ID of the section the entry belongs to
            'entry_id'      => 0    // ID of the entry the file belongs to
        )
    );

?>

Since this would happen from both the /frontend/ and /backend/ I’m not sure what the designation should actually be, and I’m too tired to work it out! :P

So for instance you could write an extension that subscribes to this delegate and resizes images when they are uploaded through a specific field. Alternatively if you wanted to send files off to a CDN, or to a batch processor (e.g. video codec encoding) this could also be achieved here.

Apart from the case of images, I’m struggling to think of another use for this. This alone leads me to think that a dedicated Image Upload field would make more sense. It already seems like we’re moving that direction with an Image Upload and Preview (to be retired I hope), and an Image Crop extension in the works.

I agree Nick, a dedicated extension that serves the purpose of cropping and sizing is key to a smooth transition for clients.. images being uploaded that are masssiiiiive is the biggest headache I encounter at present.

Not sure if this would be applicable here, but what if you were sending the files off to an ECM such as Alfresco? Would this delegate make sense in that context (needing to rePOST the file to the ECM, then write result data back to the Symphony entry)?

So for instance you could write an extension that subscribes to this delegate and resizes images when they are uploaded through a specific field.

This function was one of the possibilities I had in mind with my field wrapper extension. Too bad I can’t find the thread on it anymore…

but what if you were sending the files off to an ECM such as Alfresco? Would this delegate make sense in that context (needing to rePOST the file to the ECM, then write result data back to the Symphony entry)?

To be honest, there are already delegates for doing this (when creating/editing entries in the backend). Once the entry is created, you can inspect the section, get the file from a specific field, and do what you want with it.

The nice thing about a delegate in the field specifically means that it would trigger from the backend (/symphony/)and the frontent (Events). But you could achieve this today (both front and backend) without adding additional delegates.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details