How to change logo dynamically?
This should echo the path to the theme logo, which you could wrap in an  tag:

&lt;?php echo theme_get_setting('logo_path'); ?&gt;


If you want to re-size, crop, or modify the image you should do that in an image style. Once you have made an image style in Configuration > Media > Image Styles, you can echo the logo with that style like so:

&lt;?php echo image_style_url('my_style_name', theme_get_setting('logo_path')); ?&gt;