public function regenerateFile($postId) {
	    @set_time_limit(120);

	    $fullsizepath = get_attached_file( $postId );
	    if (!file_exists($fullsizepath)) {
	        if (function_exists('_load_image_to_edit_path')) {
                $fullsizepath = _load_image_to_edit_path($postId);
            } else {
	            Logger::warning("The function '_load_image_to_edit_path' does not exist, using internal implementation.");
	            $fullsizepath = $this->loadImageToEditPath($postId);
                Logger::warning("$postId => $fullsizepath");
            }
	    }

	    if (!file_exists($fullsizepath)) {
		    if (strpos($fullsizepath, 'http') === 0) {
			    $path = parse_url($fullsizepath, PHP_URL_PATH);
			    $pathParts = explode('/', $path);
			    $file = array_pop($pathParts);

			    $uploadDirInfo = wp_upload_dir();

			    $filepath = $uploadDirInfo['path'].'/'.$file;
			    Logger::startTiming("Downloading fullsize '$fullsizepath' to '$filepath'");
			    file_put_contents($filepath, file_get_contents($fullsizepath));
			    Logger::endTiming("Finished downloading fullsize '$fullsizepath' to '$filepath'");

			    if (!file_exists($filepath)) {
			        return "File '$fullsizepath' could not be downloaded.";
                }

			    $fullsizepath = $filepath;
		    } else {
		        return "Local file '$fullsizepath' does not exist and is not a URL.";
		    }
	    }

	    Logger::startTiming('Regenerating metadata ...', ['id' => $postId]);
	    $metadata = wp_generate_attachment_metadata( $postId, $fullsizepath );
	    Logger::endTiming('Regenerating metadata ...', ['id' => $postId]);

	    wp_update_attachment_metadata($postId, $metadata);

	    return true;
    }