I’m working on the avatar upload on my website and would like for users to be able to input an image using URL’s.
How would I go about taking the image from the URL supplied in the form and checking its file format (.png, .jpg, .gif), file size (50kb max), and file dimension(100×100 max)?
You can retrieve the file with cURL, file_get_contents, copy, or sockets (fsockopen). Once you have it, checking the file format, file size and file dimensions are the same as the code you wrote to do it from local uploads.
http://php.net/manual/en/function.getimagesize.php
http://php.net/manual/en/function.filesize.php
https://www.php.net/manual/en/function.finfo-file.php