<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>get chinaz info</title>
<link rel="stylesheet" type="text/css" href="/img/css/admin.css" />
<script type="text/javascript" src="/img/js/jquery-1.4.2.min.js"></script>
</head>
<body>
</form>
<!-- <img src="https://img-blog.csdnimg.cn/2022010616404780876.jpeg">
<?php
$base64_image_content = "https://img-blog.csdnimg.cn/2022010616404780876.jpeg";
$name = date('Y-m-d H:i:s',time());
if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $result)){
$type = $result[2];
$new_file = "test.{$type}";
if (file_put_contents($new_file, base64_decode(str_replace($result[1], '', $base64_image_content)))){
echo '新文件保存成功:', $new_file;
}
}
$dst_path = 'test.jpg';
//创建图片的实例
$dst = imagecreatefromjpeg($dst_path);
//打上文字
$font = 'simsun.ttc';//字体
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$black = imagecolorallocate($dst, 0x00, 0x00, 0x00);//字体颜色
imagefttext($dst, 20, 0, 5, 50, $black, $font, '1');
imagefttext($dst, 20, 0, 85, 50, $black, $font, '2');
imagefttext($dst, 20, 0, 155, 50, $black, $font, '3');
imagefttext($dst, 20, 0, 225, 50, $black, $font, '4');
imagefttext($dst, 20, 0, 5, 130, $black, $font, '5');
imagefttext($dst, 20, 0, 85, 130, $black, $font, '6');
imagefttext($dst, 20, 0, 155, 130, $black, $font, '7');
imagefttext($dst, 20, 0, 225, 130, $black, $font, '8');
imagejpeg($dst,'3.jpg');
//输出图片
//list($dst_w, $dst_h, $dst_type) = getimagesize($dst_path);
//switch ($dst_type) {
// case 1://GIF
// header('Content-Type: image/gif');
// imagegif($dst);
// break;
// case 2://JPG
// header('Content-Type: image/jpeg');
// imagejpeg($dst);
// break;
// case 3://PNG
// header('Content-Type: image/png');
// imagepng($dst);
// break;
// default:
// break;
//}
imagedestroy($dst);
?>
</body>
</html>