Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi M?ns, just wondering what you thought of this idea and if there’s any chance you might implement it?! ??

    Thanks!

    It’s not a bad idea, I might add this feature in a future relase. Thank you!

    Awesome, thanks! I look forward to it! ??

    I agree the important part of let the client fix their filenames in the backend somehow. They often understand the bad filename when they actually publish the post or link to that PDF file… A quick file rename process could fit well in the context of the Enable Media Replace plugin.

    This, without clutter the media library table OR using “change title also rename file”. All the plugins today for this simple task are doing to much and NOT for useful projects, clients.

    There is some user experiance to think about:

    I suggest that this option should NOT connect to Replace the file, use new file name and update all links exisiting function. Why? Clients cant handle to much at the same task… They WILL rename the file wrong a couple of times, and upload the file each time for renaming the fysical servername is not a good idea. Non developers/ client users cant “plan” their filenames and will mix under_scores, hy-phe-ns and cAsEs.

    I suggest an third option like Use new file name and update all links and a simple input text field.

    IF this field is preloaded with current filename, make it without the extension please…

    For dummie users, I would like to see the field with the exisiting Title of the file, or maybe better EMPTY, and an optional hook to sanitize_file_name() that makes a user-written in the text-field:

    My blogname photo 1234

    To

    my-blogname-photo-1234.jpg

    We dont wanna end up with:

    My-blognamephoto_1234-.JPEG.jpg

    This will happen if the user see the old filename, extensions or MUST write a UNIX correct stuff by themself…

    Summary and tip:

    The process must go through sanitize_file_name(), but this process is already in mind by EMR (Enable Media Replace) for the existing routines. Any hook or filter should be done early by EMR, so any other clean up filename plugs hooks after EMR.

    As for another plugin, I wrote a long support suggestion about Clean upload filenames handling:

    …For all the filename cleaning handling, I suggest running by wp core sanitize_file_name() means, other plugin like Enable Replace Media, buddypress etc etc get cleaned by Upload plus.

    wp_handle_upload() is using wp_handle_upload_prefilter() AND wp_unique_filename() and the latter is using sanitize_file_name()

    So instead of using add_action for wp_handle_upload(), and rewrite the file all over again, just focus on sanitize_file_name(), and then skip wp_unique_filename(). Its already parsed. Safe and WP style.

    Hope this info helps if ya implement the option into your plugin. End of suggestion …

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Suggestion: rename existing media files’ is closed to new replies.