Support » Plugin: Auto Post Thumbnail » [Plugin: Auto Post Thumbnail] Broken urls to images fix

  • circlecube

    (@circlecube)


    @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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • circlecube

    (@circlecube)

    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?

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Auto Post Thumbnail] Broken urls to images fix’ is closed to new replies.