Open
Conversation
itsrachelfish
requested changes
Oct 28, 2024
Member
itsrachelfish
left a comment
There was a problem hiding this comment.
These changes only work when uploading files via the upload page. It is also possible to embed images and video by including them in a wiki page, for example:
img[https://download.havecamerawilltravel.com/sample-images/webp/webp-example.webp]
If you try to embed this image into a wiki page it returns an error:
image/webp: Unsupported format! Please use: jpg, gif, png, webm, gifv, mp4, or ogv
creature
reviewed
Feb 25, 2026
creature
left a comment
There was a problem hiding this comment.
Rachel asked me to review this PR, so I gave it a look! I left a couple of suggestions inline.
Comment on lines
98
to
+130
| switch($Mime){ | ||
| case "image/jpg": | ||
| $Extension = "jpg"; | ||
| break; | ||
| case "image/jpeg": | ||
| $Extension = "jpeg"; | ||
| break; | ||
| case "image/gif": | ||
| $Extension = "gif"; | ||
| break; | ||
| case "image/png": | ||
| $Extension = "png"; | ||
| break; | ||
| case "image/webp": | ||
| $Extension = "webp"; | ||
| break; | ||
| case "video/webm": | ||
| $Extension = "webm"; | ||
| break; | ||
| case "video/mp4": | ||
| $Extension = "mp4"; | ||
| break; | ||
| case "video/quicktime"; | ||
| $Extension = "mov"; | ||
| break; | ||
| case "video/ogg": | ||
| $Extension = "ogv"; | ||
| break; | ||
| case "image/svg+xml": | ||
| $Extension = "svg"; | ||
| break; | ||
| default: | ||
| return "$Mime: Unsupported format! Please use: jpg, gif, png, webm, gifv, mp4, or ogv"; | ||
| return "$Mime: Unsupported format! Please use: jpg, gif, png, webp, webm, gifv, mp4, mov, or ogv"; |
There was a problem hiding this comment.
At a certain point I think it would be better to put these into an array:
Suggested change
| return "$Mime: Unsupported format! Please use: jpg, gif, png, webp, webm, gifv, mp4, mov, or ogv"; | |
| $supported_types = [ | |
| "image/jpg" => "jpg", | |
| "image/jpeg" => "jpeg", | |
| "image/gif" => "gif", | |
| "image/png" => "png", | |
| "image/webp" => "webp", | |
| "video/webm" => "webm", | |
| "video/mp4" => "mp4", | |
| "video/quicktime" => "mov", | |
| "video/ogg" => "ogv", | |
| "image/svg+xml" => "svg"]; | |
| if (array_key_exists($Mime, $supported_types)) { | |
| $Extension = $supported_types[$Mime]; | |
| } else { | |
| $supported_extensions = join(", ", array_slice($supported_types, 0, -1)) . " or " . end($supported_types); | |
| return "$Mime: Unsupported format! Please use $supported_extensions."; | |
| } |
| else | ||
| { | ||
| $Mime = mime_content_type($Image['tmp_name']); | ||
| error_log($Mime); |
There was a problem hiding this comment.
This should probably be removed before merging, I expect?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

was relatively simple, just a few things to check, added webp's to the thumbnail logic, and tested with transparancy and without and have confirmed this on my local instance. mov was generated with ffmpeg from an mp4 file. also works and displays with a default html5 video player