Its a nit, but would you change the comments in this function so they use the word "preview" instead of "thumbnail"?  I think of a thumbnail as a much smaller image than the image editor preview.