<?php
$image=imagecreatefromjpeg("E:tp/city.jpg");
$height=imagesy($image);
$width=imagesx($image);
$after_height=$height*0.5;
$after_width=$width*0.5;
$after=imagecreatetruecolor($after_width, $after_height);
imagecopyresampled($after, $image, 0,0,0,0, $after_width, $after_height, $width, $height);
imagejpeg($after,"E:tp/after.jpg",100);
imagedestroy($after);
?>
<b>使用php创建缩略图</b>
<table>
<tr>
<td>原图:</td>
<td>缩图:</td>
</tr>
<tr>
<td><img src="E:tp/city.jpg"/ ></td>
<td><img src="E:tp/after.jpg"/></td>
</tr>
</table>
错因:
[Web浏览器] "Not allowed to load local resource: file:///E:/tp/city.jpg" /phptext1/gd.php (8)
[Web浏览器] "Not allowed to load local resource: file:///E:/tp/after.jpg" /phptext1/gd.php (9)