I'm not sure where you are using this code.
Of course you have to setup the image object.
http://www.zenphoto.org/news/zenphotos-object-model-framework#creating-a-new-object
If it's part of the next_image() loop the image object is already setup so then you can try:
if (getSuffix($_zp_current_image->filename) == "gif" {etc...