Skip to content
Open
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 rotbot.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private function checkImage(array $picture): Image {
if(substr(strtolower($picture['title']),-4) == ".jpg" OR substr(strtolower($picture['title']),-5) == ".jpeg") { $image->filetype = "jpg"; }
else if(substr(strtolower($picture['title']),-4) == ".png") { $image->filetype = "png"; }
else if(substr(strtolower($picture['title']),-4) == ".gif") { $image->filetype = "gif"; }
// if(substr(strtolower($picture['title']),-5) == ".tiff" OR substr(strtolower($picture['title']),-4) == ".tif") { $image->filetype = "tif"; }
if(preg_match('/\.tiff?$/i',$picture['title'])) { $image->filetype = "tif"; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’d keep the code consistent: either preg_match() for all file types or substr(strtolower()) for all file types.

Copy link
Author

Choose a reason for hiding this comment

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

Please feel free to upload another patch that does this or edit this patch accordingly. I found it important to keep this patch as small as possible so it's very obvious what it's supposed to do, and very easy to revert if needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with keeping the change as small as possible to make it easier to revert. However, there are two ways to ensure consistency, and only one of them makes the diff larger – the other one actually makes it even smaller and even more focused.

Copy link
Author

Choose a reason for hiding this comment

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

As said, please feel free to edit this patch.

else { $image->wrongfile = "filetype not supported (".substr(strtolower($image->title),-3).")"; }
//sortkey ab umbruchstelle beschneiden
$image->degree = trim(stristr($this->hexToStr($picture["sortkey"]), "\n", true));
Expand Down