Added: May 30, 2007 Rating: Less than 3 votes yet
Level: Beginner Software:
PHP Editors
|
function getExtension($filename){
$dot = substr (strrchr ($filename, "."), 1); return $dot; } |
This is a very small, simple fucntion. it returns the file extension of a given file (in jpg format; with no .). All I use this for is the resize function. If you try to resize a .pdf file, you will get an error, so I have this check to make sure the file extension is ok. you can also call this function outsite of the resize function like this:
|
$ext = $obj_images->getExtension("./test/img.jpg");
echo $ext; |
Thats really all there is for the function, you see how we use it in the rezise function in the next section. Sooo, next function:

10 Random PHP Tutorials :
10 Random LearnPHP.org Tutorials:











