I really like the way SE uploads an image from a URL (I’m sure many do!). I’ve been searching, but can’t find, is there a plugin or a method similar to this available for WordPress?
I know an image can be uploaded and crunched directly from a URL by entering the image URL into the File Name box after you click Upload/Insert Media >> From Computer >> Choose File
This is a great feature, but not very widely known (I actually just discovered it). I would like something a little more like SE, where there is an option that let the user know to add the image URL.
How can I go about adding simply the upload file field to a new tab in the media uploader?
Here is a tutorial for How to add a new tab in Media Upload page in wordpress, but I want to add only some text and the file upload field to that tab. Any ideas? I couldn’t find anything in the WordPress Codex that deals with this feature or the file upload field directly.
Thanks.
you can write a php script, or make your own plugin of this code here, i used it in one of my projects where i had to import a large number of images.
first, get the image, and store it in your upload-directory:
after that, we can insert the image into the media library:
and voila – here we go.
you can also set various other parameters in the attachment array.
if you got an array of urls or something like that, you can run the script in a loop – but be aware that the image functions take up a lot of time and memory to execute.
You can use the functions
download_url()
andwp_handle_sideload()
.download_url()
wp_handle_sideload()
Example:
WordPress Plugin Directory – Grab & Save
There are at least three ways to import remote images into WordPress:
Grab and Save Plugin, which is mentioned in the other answer. This plug-in is a bit older and it saves the file directly, so thumbnails in different sizes are not created. Last update over 2 years ago at the time of writing.
Import External Image Plugin has bulk import for remote linked images. You may need to increase your PHP memory limit for this to work. Last update over 2 years ago at the time of writing.
Save & Import Image from URL Plugin imports the image using native functions, so it is properly created in the media gallery and all thumbnails etc. are made. This plugin is last updated in 2016 and works with WordPress 4.7
Disclosure: I created the Save & Import Image from URL Plugin