doushanlv5184 2015-06-18 23:59
浏览 44

WordPress wp_get_image_editor返回“invalid_image”错误

I've passed a direct URL to an image on my site into the wp_get_image_editor() function, and the function always returns the "invalid_image" error.

The URL is certainly correct and the image is certainly real; Chrome lets me click the URL in the debug output and it opens a new tab showing the image. The image is a 620×413 JPEG, so it's not exactly an edge case (I also tested a 700×490 png just to be sure). I also tried using the URL of an unrelated publicly-accessible image that I found on Google image search, and the same thing happened.

To make things extra confusing, this is happening inside of a plugin that worked perfectly on the Ubuntu install I developed it on, and started throwing a fit only after I deployed it to a production server. This makes me wonder if it might be some sort of esoteric configuration issue, but I don't see how it could be. I'm using WordPress 4.2.2.

  • 写回答

2条回答 默认 最新

  • doukun1450 2015-07-15 04:10
    关注

    Finally solved this by using the local path to the image instead of the public path (wp-content/uploads/2015/06/my_image.png instead of www.mysite.com/wp-content/uploads/2015/06/my_image.png). WordPress could really use more helpful messaging here.

    评论

报告相同问题?