WordPress.org

Ready to get started?Download WordPress

Forums

Enable Media Replace
[resolved] Suggestion: rename existing media files (5 posts)

  1. Jeremy
    Member
    Posted 1 year ago #

    Hi, this is a very userful plugin! Just wondering if you'd consider adding to it the ability to rename an existing media file, as an extra feature?

    Basically similar to the functionality provided by this plugin:
    http://wordpress.org/extend/plugins/rename-media-files/

    It would be great to have that functionality included in your plugin (it's a similar feature to what yours provides - ie. manipulating media files) - because this would eliminate the need to have two plugins (fewer plugins = better), and because that other plugin is outdated and I think not maintained anymore anyway. :)

    What do you think?

    http://wordpress.org/extend/plugins/enable-media-replace/

  2. GermanKiwi
    Member
    Posted 1 year ago #

    Hi Måns, just wondering what you thought of this idea and if there's any chance you might implement it?! :)

    Thanks!

  3. Måns Jonasson
    Member
    Plugin Author

    Posted 1 year ago #

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

  4. GermanKiwi
    Member
    Posted 1 year ago #

    Awesome, thanks! I look forward to it! :)

  5. Jonas Lundman
    Member
    Posted 1 year ago #

    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 ...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.