Different sidebar for template-custom.php

Probably solution is very simple but I just can’t get it work.

I have sidebar-primary on my front page, and my second sidebar on other pages. I’m using this:

<?php  
if ( is_page() ) :    
  dynamic_sidebar('sidebar-boczny'); 
else:   
  dynamic_sidebar('sidebar-primary');
endif;  
?>

Everything so far is ok, but ImageStore gallery can use default templete which is single (sidebar-primary is showed) or I can choose cutom templete (again sidebar-primary) and I want to display sidebar-boczny.

I was trying to add:

elseif ( is_page_template(template-custom.php) ) :    
  dynamic_sidebar('sidebar-boczny'); 

But this won’t work.

The Main template being used is: template-custom.php
The Base template being used is: base.php

I’ve removed templete-custom.php from config.php.

Any solution for this?

is_page_template requires a string. Did you try is_page_template('template-custom.php') (with the quotes)?

Yes, sorry, I was trying it in first place, code above was written here not pasted and I just forgot quotes.

link: http://dwietrzecie.pl/gmina_bobrowice/galeria/dychow-3/
(there could be something different there because I change it often)

Any other suggestions?

EDIT:

Solution:

<?php  
if ( is_page() ) :    
  dynamic_sidebar('sidebar-boczny'); 
elseif ( is_singular('ims_gallery')) :    
  dynamic_sidebar('sidebar-boczny');
else:   
  dynamic_sidebar('sidebar-primary');
endif;  
?>