How to save the image from browser into Directory by PHP code..
First I pass an image into a php file via:
<http://localhost/filename.php?image=image.png>
I have code like below in filename.php:
$image = $_GET['image'];
header('Content-type: image/png');
imagepng($image);
now the image will be shown in the browser. but how I save it into directory? I tried this
file_put_contents(DIR_IMAGE.'watermark.png', file_get_contents(the link http://.....=image.png));
the files is saving into the directory but the file is corrupted/damage. how can I do workable? Thanks