$oldW) { /* Portrait */ $limiting_dim = $oldW; } else { /* Landscape */ $limiting_dim = $oldH; } /* Create the New Image */ $new = imagecreatetruecolor($thumbSize, $thumbSize); /* Transcribe the Source Image into the New (Square) Image */ imagecopyresampled($new, $src, 0, 0, ($oldW - $limiting_dim) / 2, ($oldH - $limiting_dim) / 2, $thumbSize, $thumbSize, $limiting_dim, $limiting_dim); imagejpeg($new, $thumbFile, 100); imagedestroy($new); return file_exists($thumbFile); } /** * file path fixer * * @access public * @param string $path * @return string */ public static function pathFixer($path) { return str_replace("/", DIRECTORY_SEPARATOR, $path); } }