-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction_openimage.php
executable file
·45 lines (32 loc) · 1.05 KB
/
function_openimage.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
45
<?php
function open_image ($file) {
# JPEG:
$im = @imagecreatefromjpeg($file);
if ($im !== false) { return $im; }
# GIF:
$im = @imagecreatefromgif($file);
if ($im !== false) { return $im; }
# PNG:
$im = @imagecreatefrompng($file);
if ($im !== false) { return $im; }
# GD File:
$im = @imagecreatefromgd($file);
if ($im !== false) { return $im; }
# GD2 File:
$im = @imagecreatefromgd2($file);
if ($im !== false) { return $im; }
# WBMP:
$im = @imagecreatefromwbmp($file);
if ($im !== false) { return $im; }
# XBM:
$im = @imagecreatefromxbm($file);
if ($im !== false) { return $im; }
# XPM:
$im = @imagecreatefromxpm($file);
if ($im !== false) { return $im; }
# Try and load from string:
$im = @imagecreatefromstring(file_get_contents($file));
if ($im !== false) { return $im; }
return false;
}
?>