Extend Asset Module

edited July 2015 in Modules
Hi,
I have a requirement to extend the asset module.
In some of my modules where I upload assets the requirement is to encode the image filename.

My idea is to have an extra checkbox in the upload mask "Encrypt/Encode Filename". If this box is ticked then on saving the asset the filename gets encrypted via for example md5($filename) or another method. The upload then should return the new filename.

Is this possible with your asset module? Which files do I have to extend? Or would you propose some postprocessing in the save method of the module for this?

Comments

  • edited 6:29AM
    If you are using a file field type for a module or a page layout field, there is an encrypt_name parameter you can use to do this. The global Asset module doesn't have this option though.
    http://docs.getfuelcms.com/general/forms#file
  • edited 6:29AM
    Hi,
    I have configured my form field to encrypt the filename
    $fields['image'] = array('label' => lang('form_label_image'), 'folder' => 'images/mannschaft', 'accept' => 'jpg|jpeg|png', 'encrypt_name' => TRUE, 'type' => 'file', 'overwrite' => TRUE, 'ignore_representative' => TRUE, 'hide_options' => TRUE );

    But when I save a record, the filename is not encrypted... what have I done wrong?
  • edited 6:29AM
    If you set the overwrite value to FALSE, it should work. The names will be unique so the overwrite property won't have any effect.
  • edited 6:29AM
    Ah, that makes sense :-)
    It worked!
Sign In or Register to comment.