I know of imagecreatefromgif(), imagecreatefromjpeg(), and imagecreatefrompng() but is there a way to create an image resource (for png preferably) from a url of any
First fetch the url using file_get_contents($url)
function and the save the content to a file. After that you can use proper image manipulation functions to further changes. You can use following code to save image from url. Here is the sample code:
$url = "http://sample.com/image.png";
$arr = explode("/",$url);
$img_file = dir(__FILE__).'/'.$arr[count($arr)-1];
$data = file_get_contents($url);
$fp = fopen($img_file,"w");
fwrite($fp,$data);
fclose($fp);
Thanks.