Date: 07/07/00
- Next message: andreas otto: "Re: [phplib] Extension of Files"
- Previous message: Jose Luis Rodríguez Sevilla: "[phplib] Extension of Files"
- In reply to: Jose Luis Rodríguez Sevilla: "[phplib] Extension of Files"
- Next in thread: andreas otto: "Re: [phplib] Extension of Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
try:
if(isset($FILE))
{
$type = getimagesize($FILE); // Return's a array [Width][Height]['height=xxx width=xxx'][1/2/3 (where 1=GIF, 2=JPG, 3=PNG)]
$ext = $type[3];
if($ext == 1)
echo "The file is a GIF-File";
elseif($ext == 2)
echo "The file is a JPG-File";
elseif($etc == 3)
echo "The file is a PNG-File";
else
echo "The file is a UNKOWN image-type";
}
----- Original Message -----
From: Jose Luis Rodríguez Sevilla
To: phplib <email protected>
Sent: Friday, July 07, 2000 2:51 PM
Subject: [phplib] Extension of Files
I want to know if a file ($f) is an image file; i try to extract the extension (.gif or .jpg) of this file but i don't know how i can do it.
If you know how, tell me a part of code of this or an example.
if (isset($FILE)){
$f = $FILE;
if (filesize($f) < $max_file_size){
$complet_file = explode(".", $FILE);
$pos = count($complet_file);
$pos = $pos - 1;
$extension = $complet_file[$pos];
$ext = strtolower($extension);
if (($ext == "gif") || ($ext == "jpg")){
..........
}
Thank You.
- Next message: andreas otto: "Re: [phplib] Extension of Files"
- Previous message: Jose Luis Rodríguez Sevilla: "[phplib] Extension of Files"
- In reply to: Jose Luis Rodríguez Sevilla: "[phplib] Extension of Files"
- Next in thread: andreas otto: "Re: [phplib] Extension of Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

