Home > php教程 > php手册 > body text

PHP native remote address pictures are saved locally

WBOY
Release: 2016-09-27 14:04:26
Original
1383 people have browsed it

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);

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template