<?php
$thumbnails_folder = './images/';
// 缩略图生成超时时间
$cache_expire_time = 60;
// 缩率图生成质量
$image_quality = 100;
// 缩略图格式类型 (1 = GIF, 2 = JPG, 3 = PNG)
$image_type = $_POST["type"];
// 缩略图大小
$max_x = 1440;
$max_y = 1440;
$cut_x = 0;
$cut_y = 1440;
if (isset($_POST['url'])) {
$website_url = $_POST['url'];
}
else {
die("Site URL must be specified.");
}
if ($image_type == 1) $output_format = 'gif';
if ($image_type == 2) $output_format = 'jpg';
if ($image_type == 3) $output_format = 'png';
$website_url_md5 = date(Ymdhms);
$cached_filename = $thumbnails_folder . $website_url_md5 . '.' . $output_format;
// 是否有快取网站截图图片
if (!file_exists($cached_filename)|| filemtime ($cached_filename) + $cache_expire_time * 60 < time() ) {
$minwidth = $_POST["arear"];
//调用插件,获得裁剪的图片,并保存在服务器端
@exec("IECapt.exe --url=".$website_url." --out=".$cached_filename." --min-width=".$minwidth );
}
if (!file_exists($cached_filename)) {
die("存储缩略图的目录没有创建!.");
}
// create class instance
//include("image.class.php");
//$img = new Zubrag_image;
//
//// get parameters
//$img->image_type = $image_type;
//$img->quality = isset($_POST['quality']) ? intval($_POST['quality']) : $image_quality;
//$img->max_x = isset($_POST['x']) ? intval($_POST['x']) : $max_x;
//$img->max_y = isset($_POST['y']) ? intval($_POST['y']) : $max_y;
//$img->save_to_file = true;
//$img->cut_x = $cut_x;
//$img->cut_y = $cut_y;
//
//// generate thumbnail and show it
//$img->GenerateThumbFile($cached_filename,'');
echo "<script>alert('快照成功!');history.back(-1);</script>";
?>
评论1
最新资源