[php] $url = $_POST[‘image’];
function get_content($URL){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$imagesmall = get_content($url);
$imagelarge = get_content($url);
$path_parts = pathinfo($url);
$extension = ($path_parts['basename']);
file_put_contents('../uploads/small_'.$extension, $imagesmall);
file_put_contents('../uploads/large_'.$extension, $imagelarge);[/php]
This is my current code and I would like to crop the $imagesmall and $imagelarge before putting the contents to the server. Can anyone help me? I’m a bit new to this.