private function make_square_image($infn, $gd_OR_magick = "GD")
 {
     // global var $path_prefix has been removed - please, use PA::$path static variable
     $directory = PA::$project_dir . "/web/files/square/";
     //TO DO: Remove hardcoding here.
     if (!is_dir($directory)) {
         ImageResize::try_mkdir($directory);
     }
     $file_path = explode("/", $infn);
     // TO DO: Rename images to avoid conflicts.
     $imageName = $file_path[count($file_path) - 1];
     $destination = $directory . $imageName;
     if (file_exists($destination) && filemtime($destination) > filemtime($infn)) {
         return SQUARE_IMAGES . '/' . $imageName;
     }
     $dimensions = getimagesize($infn);
     $width = $dimensions[0];
     $height = $dimensions[1];
     if ($width == $height) {
         // Image is a square image
         copy($infn, $destination);
         return SQUARE_IMAGES . '/' . $imageName;
     }
     $X_start = $Y_start = $width_final = $height_final = $offset = 0;
     if ($width > $height) {
         // width more than height
         $X_start = round(($width - $height) / 2);
         $Y_start = 0;
         $offset = $height;
         $width_final = $height_final = $height;
     } else {
         // height more than width
         $X_start = 0;
         $Y_start = round(($height - $width) / 2);
         $width_final = $height_final = $width;
         $offset = $width;
     }
     if ($gd_OR_magick == "MAGICK") {
         $cmd = 'convert -crop ' . $width_final . 'x' . $height_final . '+' . $X_start . '+' . $Y_start . ' ' . $infn . ' ' . SQUARE_IMAGES . '/' . $imageName;
         system($cmd, $retval);
         return SQUARE_IMAGES . '/' . $imageName;
     }
     $orig = ImageResize::loadimage($infn);
     $imageDestination = imagecreatetruecolor($width_final, $height_final);
     imagecopyresampled($imageDestination, $orig, 0, 0, $X_start, $Y_start, $width_final, $height_final, $offset, $offset);
     imagejpeg($imageDestination, $destination, 100);
     imagedestroy($imageDestination);
     imagedestroy($orig);
     return SQUARE_IMAGES . '/' . $imageName;
 }