function boyutlandir path folder newwidth 250 filename basename path f

 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
function boyutlandir($path, $folder)
{
$newwidth = 250;
$filename = basename($path);
$file_extension = strtolower(substr(strrchr($filename,"."),1));
$boyutlar = getimagesize($path);
$resimorani = $newwidth / $boyutlar[0];
$newheight = $resimorani*$boyutlar[1];
$thumb = @imagecreatetruecolor($newwidth, $newheight);
imagealphablending($thumb, false);
imagesavealpha($thumb, true);
if($file_extension=="jpeg"||$file_extension=="jpg")
{
$source = imagecreatefromjpeg($path);
$kayit = $folder.'/'.$filename;
}
else
if($file_extension=="gif")
{
$source = imagecreatefromgif($path);
$kayit=$folder.'/'.$filename;
}
else if($file_extension=="bmp")
{
$source = imagecreatefromwbmp($path);
$kayit = $folder.'/'.$filename;
}
else
if($file_extension=="png")
{
$source = $source = imagecreatefrompng($path);
$kayit = $folder.'/'.$filename;
}
@imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $boyutlar[0], $boyutlar[1]);
if($file_extension=="jpeg"||$file_extension=="jpg")
{
imagejpeg($thumb, $kayit);
}
else if($file_extension=="gif")
{
imagegif($thumb,$kayit);
}
else if($file_extension=="bmp")
{
image2wbmp($thumb,$kayit);
}
else if($file_extension=="png")
{
imagepng($thumb, $kayit);
}
}