I would say that the problem with your current code, if you don't want to change the PHP as blueghozt suggested, is that you are assigning
var gallery = $('#thumbs').galleriffic(...)
once the page has loaded, not once the <li>s are returned by your ajax call.
Instead of putting this code in $(document).ready, try putting it at the end of your getImages() function.