header('Content-Type: image/jpeg');
$imageURL = $_POST['url'];
$image = @ImageCreateFromString(@file_get_contents($imageURL));
if (is_resource($image) === true)
imagejpeg($image, 'NameYouWantGoesHere.jpg');
else
echo "This image ain't quite cuttin it.";
This is the code I have to convert a url that I receive from an html form into an image. However, whenever I try to display it or take it off the server to look at it, it 'cannot be read' or is 'corrupted'. So for some reason it is converted to an image, recognized as a proper resource, but is not proper image at that point. Any ideas?