WordPress.org

Ready to get started?Download WordPress

Forums

Auto Post Thumbnail
Broken urls to images fix (3 posts)

  1. circlecube
    Member
    Posted 2 years ago #

    @adityamooley -

    I was using this plugin in conjunction with another plugin which generates posts for me. It was inserting an image with the src attribute being a long url with a quertystring. The images were properly being added to my site but the url was messed up and ended up being a broken link on the frontend. It looked like the url was being escaped an extra time after it generated the filename or wordpress escaped it again on upload?

    Is there a way to have the filename at line 302 properly escaped to match what gets uploaded to wordpress?

    http://wordpress.org/extend/plugins/auto-post-thumbnail/

  2. circlecube
    Member
    Posted 2 years ago #

    Here is my fix - a quick fix that I'm not guessing fixes this issue for everyone, but it works for me now.

    Add a check after it gets the first substring of everything in the url after the last '/'. I noticed in all of my urls which were of images (on googleuserproxy.com from the google+ API) had a '%2F' just before the actual file name. So I wanted to check for that string in the url and only get what came after it. Insert after line 302:

    if(strrpos($filename, '%2F')){
            $filename = substr($imageUrl, (strrpos($imageUrl, '%2F'))+3);
        }

    Is there a better way to do this? And if not want to roll this into the next release so it doesn't break me?

  3. darrenwatt
    Member
    Posted 2 years ago #

    circlecube - thanks, good fix worked for me.
    +1 for incorporating into the release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic