If you're using MS SQL Server >= 2008 you could try your luck with Creating CLR Stored Procedures
]. Another useful resource is CLR Stored Procedures
It will mean of course that the images will be transferred to the SQL server before being thumbnailed. This will put more load on your network as well as the SQL Server. Not sure if this is what one would want to happen. :)
: MSDN writes:
"Note: The ability of SQL Server to execute CLR code is off by default. You can create, alter, and drop database objects that reference managed code modules, but these references will not execute in SQL Server unless the clr enabled Option is enabled by using sp_configure (Transact-SQL)."