Support » Plugin: Auto Save Remote Image » Doesn't handle % characters correctly

  • Resolved etchedinpixels


    Hi, great idea for a plugin.

    However, I’m having some problems using it with my Smugmug hosted images due to the way it translates % symbols in the URL.

    Here’s what happens. I insert an image

    And the plugin uploads it to my site as

    However, WordPress then fails to load the image, it returns a 404.

    I found that the URL needs to be entered as

    Note that in the browser any % in the filename needs to be changed to %25 the plugin isn’t doing this when inserting the URL into the post.

    I’m going to see what I can do to fix the code but I barely know anything. I’ll post if I have a solution. Thanks for all the great work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author prebhdevsingh


    Hi there,

    I will try to fix this bug and update the plugin soon. Thanks for pointing it out.



    I don’t know much about php but after talking with my developer friend, he suggested the URLDECODE function to convert the image filename before copying it on one’s WordPress site.

    It now seems to handle the %3F symbol in my smugmug image correctly.
    It takes the image URL

    and stores the file locally as Giantpeachmoktak-M.jpg

    It would be nice if it also converted the %20 to ‘_’ . But the main thing is that it seemed to handle the question mark (encoded as %3F) correctly.

    I replaced:

    $mirror = wp_upload_bits( str_replace('%20', '', basename( $first_image )), '', wp_remote_retrieve_body( $get ) );


    $mirror = wp_upload_bits( urldecode(basename( $first_image )), '', wp_remote_retrieve_body( $get ) );

    Prebhdev, would you mind telling me if I implemented this correctly and it’s working for you too?

    Plugin Author prebhdevsingh


    Hi there,

    Your friend is correct. I have uploaded new copy of the plugin which fixes this issue. Instead of using urldecode, I’m instead using rawurldecode. This should take care of the problem with % signs in filenames.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Doesn't handle % characters correctly’ is closed to new replies.