getFileExtension() public static method

Returns the lowercased file extension of $path.
public static getFileExtension ( string $path ) : string | boolean
$path string
return string | boolean false if not '.' is present in $path.
Example #1
0
 /**
  * @param resource $image
  * @param string   $path
  * @param int      $quality between 0 and 10
  *
  * @return bool
  */
 public function writeImage($image, $path, $quality = 8)
 {
     ob_start();
     switch (Tools::getFileExtension($path)) {
         case 'png':
             imagepng($image, null, $quality);
             break;
         case 'jpeg':
         case 'jpg':
             imagejpeg($image, null, $quality * 100);
             break;
         case 'gif':
             imagegif($image);
             break;
     }
     $imageBuffer = ob_get_clean();
     return $this->write($path, $imageBuffer);
 }