创造什么样的,你只需要阅读此页:http://us.php.net/imagecopy
您可以使用这样的事情,只是改变$左侧和顶部$对应于其中的日期戳在图像上。
<?php
// Original image
$filename = 'someimage.jpg';
// Get dimensions of the original image
list($current_width, $current_height) = getimagesize($filename);
// The x and y coordinates on the original image where we
// will begin cropping the image
$left = 50;
$top = 50;
// This will be the final size of the image (e.g. how many pixels
// left and down we will be going)
$crop_width = 200;
$crop_height = 200;
// Resample the image
$canvas = imagecreatetruecolor($crop_width, $crop_height);
$current_image = imagecreatefromjpeg($filename);
imagecopy($canvas, $current_image, 0, 0, $left, $top, $current_width, $current_height);
imagejpeg($canvas, $filename, 100);
?>
一个类似的例子是:给定的图像(SRC),偏移量(X,Y)和尺寸(W,H):
实施 “作物” 功能基本方式。
crop.php:
<?php
$w=$_GET['w'];
$h=isset($_GET['h'])?$_GET['h']:$w; // h est facultatif, =w par défaut
$x=isset($_GET['x'])?$_GET['x']:0; // x est facultatif, 0 par défaut
$y=isset($_GET['y'])?$_GET['y']:0; // y est facultatif, 0 par défaut
$filename=$_GET['src'];
header('Content-type: image/jpg');
header('Content-Disposition: attachment; filename='.$src);
$image = imagecreatefromjpeg($filename);
$crop = imagecreatetruecolor($w,$h);
imagecopy ($crop, $image, 0, 0, $x, $y, $w, $h);
imagejpeg($crop);
?>
这样称呼它:
<img src="crop.php?x=10&y=20&w=30&h=40&src=photo.jpg">
确定日期和时间标记总是在右下角所以在你的例子我应该这样做$脱脂= 75 ; $ left = 0; $ top = 0; (从左上角开始到最上面0位置),然后$ crop_width = imagesx($ file); $ crop_height =(imagesy($ file) - $ skim);就像我之前说过的,我并没有试图用200x200 w/h的比例缩小它,也没有试图保持任何方面,因为整个图像上的Skimming 75px甚至没有被看到 – dominicdinada 2010-09-14 20:14:30
Imagecopy不工作,它只是用黑色空间填充相同的图像在应该裁剪的区域。但它让我在我提供的链接上看起来更加接近。 – dominicdinada 2010-09-14 21:34:16