VR51 / Import-External-Images-2

Download and import remotely hosted images to the local WordPress media library
https://journalxtra.com/wordpress/plugins/wordpress-plugin-import-external-images/
GNU General Public License v3.0
44 stars 19 forks source link

Images with ? and & in the URL not getting imported #13

Open spiritfly opened 6 years ago

spiritfly commented 6 years ago

It looks like if the URL of the image contains parameters it is detected, but it does not get imported. Here is an example of such an image:

https://i.guim.co.uk/img/media/0fcd5dff58c9ca73181b3bbbca837a6968a696d8/0_0_2083_1250/2083.jpg?width=460&quality=85&auto=format&usm=12&fit=max&s=0b68772d79eb7ca4c25b36686f58c501

VR51 commented 6 years ago

Thanks for reporting this. The bit after the question mark is the query string. The image service indicated in the link provided only answers to requests that include their associated query string.

Without reading through the plugin code to refresh my memory of the image import function, I suspect the query string is stripped out by the importer before the image is downloaded and so, as in this case, the target image is not imported due to the request absent of query string being denied.

I need to give the plugin a little love to resolve a couple of faults. Will try to cover this over the weekend. Will adjust the importer to handle query strings either by keeping them in or by stripping them out. Will add a user option to allow end users to choose their preference.

If you have access to the code used by the Github site where your target images are located, you could solve your issue by adjusting to site to serve requested images whether the query string is present or not.

spiritfly commented 6 years ago

The plugin deserves all the love in the world if you ask me! I am currently using it for a project and I plan to donate once I'm finished as it does a great job! :)

I have plenty of suggestions to post if you're willing to invest some time in it. It has the potential to develop a pro version of it with a few advanced features and sell it. One of them is adding a custom retry value and custom timeout value setting for some images that are loading slow from places such as web.archive.org.

Regards!

VR51 commented 6 years ago

I was unable to get to this over the weekend. I will try and find time during this week.

Thanks for those suggestions. All good ones. If I do add many more features it will likely be after the release of WP 5.0.0 -- The Gutenberg release.