Thanks! I'll try that. Will I notice any efficiency gains from doing it with this code instead? My first impressions is that it goes through exactly the same steps as what I do in my template...
Any ideas why my template is so slow in the first place? I'm just listing a bunch of pre-generated thumbnails. It should be possible to do something like that almost instantly.