Support » Plugin: Media Rename » Title Sanitizer Regex Tweak

  • Resolved Insignis

    (@insignis)


    Hi ShadowsDweller –

    Great plugin, thank-you.

    Wondering if there is an easy tweak that I can make somewhere to your sanitizer code so that it will not remove an “x” (as in “times”) from filenames when porting them to the post title of the image?

    For example, I have a series of lenses in a product catalogue which as part of the filename and the resulting post title need to have their focal length and zoom ratio intact (i.e. 8×32). When I rename/retitle in bulk this “x” is being removed from the post title so a file name of:
    lens-rightangle-8×32-rear-projection.jpg is being sanitized to “Lens Rightangle 8 32 Rear Projection” which is great except I need that “x” back. I’ve been adding it manually, but that negates the power of your plugin!

    Unfortunately, regular expressions are not my strong point. I suspect the magic is around line 238 in class-media-rename and based on reading on regex would have thought the ‘x’ as a regular alphanumeric would be untouched in the current args. I don’t want to go tinkering where I shouldn’t be without some guidance.

    Thanks for your time in advance, hope you can point me in the right direction!

    http://wordpress.org/plugins/media-rename/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ShadowsDweller

    (@shadowsdweller)

    Could you try this with a different browser? The plugin doesn’t delete the “x”, but WordPress converts the “x” to a special symbol (3×563). Probably this is the reason why you don’t see it.

    Thread Starter Insignis

    (@insignis)

    You nailed it. Chrome and Safari both lose the x via cut and paste or direct entry. Firefox was hit and miss some were fine and others stripped, so clearly it is an encoding issue between my source, the browser and WordPress. Should have thought of that one.

    Solution that is working 100% now (knock wood) is FireFox and cutting and pasting my source information through Sublime Text. Works great and so much better than hopping from image to image!

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Title Sanitizer Regex Tweak’ is closed to new replies.