*@piotr-cz*
I see your point, but there is good reason for the implementation variance between the if-block and the ifelse-block. Note, that within the if-block the JImage-instance has *not* loaded any file and thus no pointer to a gd-resource. Within this block the file-information is directly accessed from the related file via `getimagezie()`, while in the ifelse-block the information is fetches from the loaded resource. 
Ofcourse one could load the file passed in and fetch the data from the loaded resource. But i considered to no create a resource when there is no need for it. But i'm open for your arguments.

Regarding switch/case:
I also considered to use a it but found it harder to read and impossible to wrap in my editor whereas with the if/ifelse/else block each part can be wrapped making it easier to hide parts of the code and focus on a specific portion.

If i got you completely wrong, let me know.