nazanin, you should have a look at the code samples posted by Octavio — they include the thumbnail functionality you require.