Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[brainbrowser] Add possibility to read nii.gz files with BB #5314

Merged
merged 1 commit into from
Oct 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/brainbrowser/ajax/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
header('Content-Type: application/x-mnc');
}
header('X-FileID: ' . $_REQUEST['file_id']);
readfile($image_path);
readgzfile($image_path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to break 1. minc and 2. non-gzipped .nii files?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driusan Should not. File that are not in gz format are read as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driusan as @PapillonMcGill mentioned, .mnc and .nii files can still be open with BB. I tested it before sending the PR :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driusan

readgzfile() can be used to read a file which is not in gzip format; in this case readgzfile() will directly read from the file without decompression.

https://www.php.net/manual/en/function.readgzfile.php

} else {
header("HTTP/1.1 404 Not Found");
exit();
Expand Down