It's not easy to convert certain document formats to image. php alone cannot do this.
The 'proper' way to do this is to first of all have the program installed on your server that can open the document in that format.
For example, for .doc documents you can use OpenOffice
it also can open most other document formats
You then need to setup your open office to work in 'headless' mode, sending the output to virtual display (XVFB is what you going to need on Linux)
You php script will then call OpenOffice, passing the path to uploaded doc. OpenOffice will actually open that doc. Then you need to create an image from the screen buffer. You can use ImageMagick for that
Then once you have the capture of your screen you can resize it to a thumbnail.
Look at this link for more details
http://www.mysql-apache-php.com/website_screenshot.htm
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…