That's a lot of work, you have to sanitize data, check if the user is sending something else apart from links or if something is appended to the links, if the link format is correct, if the limit is reached, if the headers are ok (considering that headers can be spoofed)... So here it is a scrap just to get links:
<?php
function get_link($data)
{
preg_match_all('/http(s)?:\/\/(.*)/i', $data, $matches);
$result = array();
foreach($matches[0] as $link)
{
$result[] = $link;
}
return $result;
}
# here place $_POST['links'] or whatever you use in the form
$form = <<<EOF
http://website.tld/image.jpg
http://www.website.tld/image_with_w.jpg
http://www.website.tld/image.png
http://<script>alert('hello');</script>
EOF;
print_r(get_link($form));
?>
I repeat: sanitize data, make sure your script filters malicious scripts, for example here you will get a javascript executed. Try to build your script and if you have doubts or something is not working post your code. Bye!