How to resize image before upload to dir (using image from url) ?
i want to resize image to 200x200 px
, how can i do that ?
i try to upload image from url to dir upload
, it's work good.
But now i want to resize image before upload, how can i do that ?
<?php
if($_POST){
$url = $_POST['url'];
$name = basename($url);
list($txt, $ext) = explode(".", $name);
$name = $txt.time();
$name = $name.".".$ext;
$upload = file_put_contents("uploads/$name",file_get_contents($url));
if($upload) echo "Success: <a href='uploads/".$name."' target='_blank'>Check Uploaded</a>"; else "please check your folder permission";
}
?>
<html>
<body>
<h3>File Upload from URL Script!</h3>
<form action="" method="post">
Your URL: <input type="text" name="url" />
</form>
</body>
</html>