src/Stdlib/Util.php
public static function resizeImageDirectory($dir, $desiredWidth = 200, $overwrite = false, $recursive = true, $subDir = 'resized') {
        foreach (self::readDir($dir, self::FILES_ONLY, $recursive, null, true) as $path => $filesArray) {
            foreach ($filesArray as $file) {
                $destination = null;
                if (!$overwrite) {
                    if (!is_dir($path . $subDir)) {
                        mkdir($path . $subDir);
                    }
                    $destination = $path . $subDir . DIRECTORY_SEPARATOR . $file;
                }
                self::resizeImage($path . $file, $desiredWidth, $destination);
            }
        }
    }
public static function resizeImageDirectory($dir, $desiredWidth = 200, $overwrite = false, $recursive = true, $subDir = 'resized') {
        foreach (self::readDir($dir, self::FILES_ONLY, $recursive, null, true) as $path => $filesArray) {
            foreach ($filesArray as $file) {
                $destination = null;
                if (!$overwrite) {
                    if (!is_dir($path . $subDir)) {
                        mkdir($path . $subDir);
                    }
                    $destination = $path . $subDir . DIRECTORY_SEPARATOR . $file;
                }
                self::resizeImage($path . $file, $desiredWidth, $destination);
            }
        }
    }
public static function resizeImageDirectory ( $ dir , $ desiredWidth = 200 , $ overwrite = false , $ recursive = true , $ subDir = 'resized' ) { foreach ( self :: readDir ( $ dir , self :: FILES_ONLY , $ recursive , null , true ) as $ path => $ filesArray ) { foreach ( $ filesArray as $ file ) { $ destination = null ; if ( ! $ overwrite ) { if ( ! is_dir ( $ path . $ subDir ) ) { mkdir ( $ path . $ subDir ) ; } $ destination = $ path . $ subDir . DIRECTORY_SEPARATOR . $ file ; } self :: resizeImage ( $ path . $ file , $ desiredWidth , $ destination ) ; } } }
Resize all images in a directory

@param string $dir Directory path of images
@param int $desiredWidth Desired width of new images
@param boolean $overwrite Overwrite old images?
@param boolean $recursive Indicates if subdirectories should be searched too
@param string $subDir If not overwrite, name of subfolder within the $dir
to resize into
Resize all images in a directory