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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
<?php function createThumb($filename,$uid, $extension, $location_, $x =150, $y=150, $proportain = 1) { $location = $location_ .$uid.'.'.$extension; if (!$image=getimagesize($filename)) { return FALSE; //return false if there is no image to create from or it is not a image } else { if ($image['2'] == '1') { $im = imagecreatefromgif ($filename); } else if ($image['2'] == '2') { $im = imagecreatefromjpeg ($filename); } else { return FALSE; // return false if filetype is not of gif or jpeg } $x_ = $x; $y_ = $y; if ($proportain == 1) { if ($image[0]<$image[1]) { $x_ = $y * ($image[0]/$image[1]); } else { $y_ = $x / ($image[0]/$image[1]); } } $dy = ($y - $y_)/2; $newim = imagecreatetruecolor($x, $y); $color = imagecolorallocate($newim, 235, 236, 236); imagefilledrectangle ($newim, 0, 0, $x, $y, $color); ImageCopyResized($newim, $im, 0, $dy, 0, 0, $x_, $y_, $image[0], $image[1]); imagejpeg($newim, $location); imagedestroy ($im); imagedestroy ($newim); return TRUE; } }
function RectangleEf($imageName, $path) { if (!$image=getimagesize($imageName)) { return FALSE; } else { if ($image['2'] == '1') $im = imagecreatefromgif ($imageName); else if ($image['2'] == '2') $im = imagecreatefromjpeg ($imageName); else return FALSE; // return false if filetype is not of gif or jpeg $color = imagecolorallocate($im, 209, 210, 212); // left // $color = imagecolorallocate($im, 0, 0, 212); imagefilledrectangle ($im, 0, 0, 40, 10, $color); imagefilledrectangle ($im, 0, 0, 10, 230, $color); imagefilledrectangle ($im, 0, 220, 40, 230, $color); // right imagefilledrectangle ($im, 190, 0, 230, 10, $color); imagefilledrectangle ($im, 220, 0, 230, 230, $color); imagefilledrectangle ($im, 190, 220, 230, 230, $color); imagejpeg($im, $path, 99); // print_r("ASDASD"); imagedestroy($im); } }
function RectangleEf2($imageName, $path) { if (!$image=getimagesize($imageName)) { return FALSE; } else { if ($image['2'] == '1') $im = imagecreatefromgif ($imageName); else if ($image['2'] == '2') $im = imagecreatefromjpeg ($imageName); else return FALSE; // return false if filetype is not of gif or jpeg $color = imagecolorallocate($im, 209, 210, 212); imagefilledrectangle ($im, 0, 0, 10, 5, $color); imagefilledrectangle ($im, 0, 0, 5, 47, $color); imagefilledrectangle ($im, 0, 42, 10, 47, $color); // right imagefilledrectangle ($im, 64, 0, 74, 5, $color); imagefilledrectangle ($im, 69, 0, 74, 47, $color); imagefilledrectangle ($im, 64, 42, 74, 47, $color); imagejpeg($im, $path, 99); // print_r("ASDASD"); imagedestroy($im); } } ?>
|