-
Notifications
You must be signed in to change notification settings - Fork 275
/
sandphoto.php
44 lines (38 loc) · 1.22 KB
/
sandphoto.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require_once("sandphoto.inc");
if ((($_FILES["filename"]["type"] == "image/png")
|| ($_FILES["filename"]["type"] == "image/jpeg")
|| ($_FILES["filename"]["type"] == "image/bmp")
|| ($_FILES["filename"]["type"] == "image/tiff")
|| ($_FILES["filename"]["type"] == "image/pjpeg"))
&& ($_FILES["filename"]["size"] < 8000000))
{
if ($_FILES["filename"]["error"] > 0)
{
header("Content-Type: text/html");
print("上传文件错误!");
return;
}
else
{
$filename = $_FILES["filename"]["tmp_name"];
$target_type = $_POST["target_type"];
$container_type = $_POST["container_type"];
//print "type:$container_type";
$parser = new PhotoTypeParser();
$parser->parse('phototype.txt');
$cw = $parser->get_width($container_type);
$ch = $parser->get_height($container_type);
$tw = $parser->get_width($target_type);
$th = $parser->get_height($target_type);
$p = new Photo();
$p->set_container_size($cw, $ch);
$p->set_target_size($tw, $th);
$n = $p->put_photo($filename, $_POST["bgcolorid"]);
// $p->render_image();
// $p->preview_image();
$download_name = $n ."张" . $parser->get_name($target_type) . "[以" . $parser->get_name($container_type) . "冲洗].jpg";
$p->download_image( $download_name );
}
}
?>