I have database 'website' having fields - title, url, snapshot to collect information of websites . Users will fillup the form so, There is no file input for fileupload. Form have inputs for title & url.

How to generate snapshot using 'imagegrabwindow' or other php functions for given url?
How to upload generated image to 'uploads' & insert data to mysql database( title, url, snapshot)?

  1. Do you really need the snapshot? If you have the URL, you can display the actual page any time you need it in an iframe.

  2. I have never used imagegrabwindow but it has limitations and issues that you may not want to live with. Link.

  3. There are services available (with APIs) that are built to take such snapshots. Some have a limited free service so if you are only doing this occasionally, that might be good enough. You have to pay for the service if you don't want the limitations.
    Link

  4. You could save the page to a PDF using HTML2PDF (or some other PDF creation tool). You should be able to save the resulting PDF file directly to a folder on your server. You don't necessarily have to save the PDF file into the database. You can just save the (unique) name of the PDF into the database record and leave the actual PDF in a folder reserved for that purpose.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.