PHP is open source scripting language. It\'s widely used to develop web applications.  Home Web Programming PHP Image Class: Function getExtension
Your Ad Here

Image Class: Function getExtension


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:



Author's URL: Nathanael Mitchell
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Web programming � everything from the basics of visual design and architecture to the specifics of applications, graphics, and scripting. More Web Programming: Most Popular Materials | Fresh Materials | More PHP Tutorials at LearnPHP.org

Add comments to "Image Class: Function getExtension"

Only registered users can write comment

No comments yet...