function dimensions jpeg array jpeg JPEG jpg JPG gif array gif GIF png

 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
function dimensions($f)
{
$jpeg = array("jpeg", "JPEG", "jpg", "JPG");
$gif = array("gif", "GIF");
$png = array("PNG", "png");
$type = explode(".", $f);
$type = $type[count($type)-1];
if (in_array($type, $jpeg))
$im_src = imagecreatefromjpeg($f);
if (in_array($type, $gif))
$im_src = imagecreatefromgif($f);
if (in_array($type, $png))
$im_src = imagecreatefrompng($f);
if (!empty($im_src))
{
$w = imagesx($im_src);
$h = imagesy($im_src);
return array($w, $h);
}
}
function filetext($f)
{
$info = file($f);
return implode("", $info);
}