开发者

How to copy an external image to local?

开发者 https://www.devze.com 2023-03-13 00:49 出处:网络
I want to retrive an http external image an copy it to a folder on my server (eg. /images/example.jpg)

I want to retrive an http external image an copy it to a folder on my server (eg. /images/example.jpg)

Is there a way to do this with symfony 2.0开发者_高级运维 or with basic PHP 5 functions?


you can do it like this:

file_put_contents('tmp.jpg', file_get_contents('http://static.adzerk.net/Advertisers/3603.jpg'));

But, be careful, if it's a web page, it maybe very slow, depending on the speed of image page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号