public function set_extension($extension)
{
// Strip any leading period
$extension = ltrim($extension, '.');
// Use this for regenerating the path, using substr
// or some other method seems like it could miss some edge-cases
$pathinfo = pathinfo($this->_file);
if (isset($pathinfo['dirname']) && isset($pathinfo['filename'])) {
// Chomp off any extension at the end
$this->_file = $pathinfo['dirname'] . '/' . $pathinfo['filename'];
}
// Save this for later
$this->_extension = $extension;
return $this;
}