Home  >  Article  >  php教程  >  PHP native remote address pictures are saved locally

PHP native remote address pictures are saved locally

WBOY
WBOYOriginal
2016-09-27 14:04:261382browse

The main requirement for this very short code is whether the folder where you save the address has write permission. If so, it can be used. If not, no error will be reported but it cannot be implemented. Without further ado, let’s get straight to the code
There are also several stone-encapsulated functions that can be used to synthesize pictures
http://www.thinkphp.cn/code/edit/id/2349.html
$url = 'Online address, but due to function, it can only support jpg or jpeg';
/**Save the image to the local image path*/
$imgurl = 'Uploads/'.rand(0,99999).'.jpg';
/**write file*/
$qrcodeurl = imagecreatefromjpeg($url);
/**Save and download to local 50 is the image quality*/
imagejpeg($qrcodeurl, $imgurl, 50);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn