PHP开发缩略图之打开文件

<?php
/*打开图片*/
$src = "https://img.php.cn/upload/course/000/000/004/581454f755fb1195.jpg";
$info = getimagesize($src);
$type = image_type_to_extension($info[2],false);
$fun = "imagecreatefrom{$type}";
$image = $fun($src);
?>

同之前相似,打开图片,传入图片获取图片的信息,然后再内存中创建一个一模一样的图片。并存起来。

继续学习
||
<?php /*打开图片*/ $src = "https://img.php.cn/upload/course/000/000/004/581454f755fb1195.jpg"; $info = getimagesize($src); $type = image_type_to_extension($info[2],false); $fun = "imagecreatefrom{$type}"; $image = $fun($src); ?>
提交重置代码