• Resolved nimas

    (@nimas-1)


    Hi, I have USP setup with the frontend form and I tried the snippet (below) from your docs to stop the extra characters being appended to the filenames, but it doesnt work in our setup. We have ShortPixel Image Optimizer installed and activated and it seems to fire before anything else (including the snippet you’ve provided for). So, it looks like it takes priority on the uploaded media. I have tried setting the snippet priority but nothing seems to avoid ShortPixel firing first. Any ideas would be greatly appreciated.

    Many thanks for the wonderful plugin btw! ??

    function usp_customize_filename_append($append) {
    	return '';
    }
    add_filter('usp_filename_append', 'usp_customize_filename_append');

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Yeah I don’t know what might be happening. It sounds like the ShortPixel plugin may be involved somehow. If you can provide steps to repeat the issue on default WP setup, I would be glad to investigate and try to resolve. Otherwise, there is not much I would be able to do here.

    Thread Starter nimas

    (@nimas-1)

    Thanks, Jeff! Yeah, we have tested it on our staging site and when ShortPixel Image Optimization plugin is enabled, it interferes with how media is processed on upload.

    On a clean WP install, with ShortPixel and USP plugins activated, and the USP snippet placed in Code Snippets plugin with priority set to 1-3, the issue can be seen. You do need to have an active (free) API key set in ShorPixel.

    We have the option to “auto optimize media on upload” in ShortPixel deactivated, but it doesnt seem to alter the outcome – the issue persists.

    Just for clarity, I’m not sure what the purpose of appending extra characters in USPs purpose is, maybe its a security or identifiying feature?

    Your help is very much appreciated! ??

    Thread Starter nimas

    (@nimas-1)

    btw, this is the ShortPixel plugin we are using: https://www.ads-software.com/plugins/shortpixel-image-optimiser/

    Plugin Author Jeff Starr

    (@specialk)

    So that’s all great information, but as explained in order for me to be able to help, I need to know the basic steps to repeat the issue on default WordPress.

    For example, the steps might look something like this:

    1. Install WordPress
    2. Install the plugin
    3. Visit such and such page
    4. Perform certain action

    Etc., until the issue/error happens. That way I can follow along and investigate asap.

    Thread Starter nimas

    (@nimas-1)

    My bad, sorry about that. Please see steps below:

    1. Clean install of WP
    2. Install & activate ShortPixel (plugin as above) and set free API
    3. Install & activate USP Plugin
    4. Create simple front-end form to any page with image uploads enabled
    5. Set image append snippet (as above)
    6. User submits post with at least one image attached
    7. Check media directory and appended characters still persist
    8. Deactivate (and clear cache if any) ShortPixel plugin and the snippet works as normal – no extra characters are appended. Reactivate plugin and issue persists.

    I hope that is what you were asking for? Let me know if not and I will revise. Really appreciate your time and help!

    Plugin Author Jeff Starr

    (@specialk)

    Okay thanks. So I followed the steps, and it looks like the issue is with ShortPixel, as each uploaded image is queued up and processed on ShortPixel servers. During that process, they must be doing something that prevents or bypasses the custom USP script. I will look into it, but I don’t think there is much that can be done from this side of the equation.

    Thread Starter nimas

    (@nimas-1)

    Thanks so much, Jeff! I understand, it is a function of ShortPixel. I will wait to see if anything can be done on your plugin side, but ill also take it up with ShortPixel. Let me know when possible. Much appreciated!

    Thread Starter nimas

    (@nimas-1)

    btw, is the appending of extra characters a required feature of USP? just wondering if it serves some function?

    Plugin Author Jeff Starr

    (@specialk)

    Yes the appended numbers are to help keep multiple file uploads unique. No numbers are appended when only one image is uploaded.

    Plugin Author Jeff Starr

    (@specialk)

    Hi @nimas-1, just wanted to follow up with this. It’s been a while with no reply, so I hope the issue is resolved? Or if there is anything I can do to help, please let me know. Thank you.

    Thread Starter nimas

    (@nimas-1)

    Hi Jeff,

    Unfotunately, I cannot find a way to resolve it from the ShortPixel side. It looks as though we’ll need to live with it for now. Unless you have something in mind? ??

    Thanks for all your help!

    Plugin Author Jeff Starr

    (@specialk)

    Okay just checking before marking thread as resolved. I am here to help with any specific questions you might have, feel free to post again anytime. Thank you, @nimas-1.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Snippet to stop appending extra characters to uploaded images not working’ is closed to new replies.