diff --git a/optimize-images.php b/optimize-images.php index fa95310..e1a18f1 100755 --- a/optimize-images.php +++ b/optimize-images.php @@ -26,10 +26,17 @@ function recurseImages($dir, &$initialBytes, &$bytesSaved) if (is_dir($current_file)) { $stack[] = $current_file; } else { - $initialBytes += filesize($current_file); - optimizeImage($current_file); - $bytesSaved += filesize($current_file); - $images++; + switch (strtoupper(pathinfo($current_file, PATHINFO_EXTENSION))) { + case 'GIF': + case 'PNG': + case 'JPG': + case 'JPEG': + $initialBytes += filesize($current_file); + optimizeImage($current_file); + $bytesSaved += filesize($current_file); + $images++; + break; + } } } }