White_Lily Posted November 20, 2012 Share Posted November 20, 2012 Hi, I was wondering if it is possible to have a script locates a website that has been entered by a user, takes a screenshot of it, saves it as a .jpg in a specified directory and then outputs that screenshot to the user? If this is possible could anyone maybe give me some links to sites that could help? I have searched the internet to very little success. Thanks - Lily Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted November 20, 2012 Share Posted November 20, 2012 How do you take a screenshot of something without first putting it on the screen? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 20, 2012 Share Posted November 20, 2012 browsershots.org does pretty much exactly that. Quote Link to comment Share on other sites More sharing options...
White_Lily Posted November 20, 2012 Author Share Posted November 20, 2012 I meant is it possible for me to code the script rather than use some random site that you need to pay for? Quote Link to comment Share on other sites More sharing options...
Jessica Posted November 20, 2012 Share Posted November 20, 2012 Well known and established free site that's been around forever = random site you need to pay for...in what universe? Quote Link to comment Share on other sites More sharing options...
White_Lily Posted November 20, 2012 Author Share Posted November 20, 2012 Okay. All i want to do is write a script that takes a screenshot of the website url that is entered by a user and that screenshot being saved to a directory and output to the user if the save was successful, thats all I want to do, i don't want to go through some other external site. I want to be able to write the script for it myself. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 20, 2012 Share Posted November 20, 2012 It is possible, yes... easy, no. As was mentioned, in order to take a "screenshot" the page must first be fully rendered. You can look into html2canvas as one method. It might suit your needs. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 20, 2012 Share Posted November 20, 2012 (edited) Okay. All i want to do is write a script that takes a screenshot of the website url that is entered by a user and that screenshot being saved to a directory and output to the user if the save was successful, thats all I want to do, i don't want to go through some other external site. I want to be able to write the script for it myself. Just to be 100% clear, you would like somebody else to write the script for you. If you were going to write it yourself you would have already. Edited November 20, 2012 by mrMarcus Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 20, 2012 Share Posted November 20, 2012 Okay. All i want to do is write a script that takes a screenshot of the website url that is entered by a user and that screenshot being saved to a directory and output to the user if the save was successful, thats all I want to do, i don't want to go through some other external site. I want to be able to write the script for it myself. Yes it can be done. But, the issue is how long will it take (months, possible years based upon your skill-set) and the quality of the solution. These solutions (at least the ones I've worked with) don't actually take a "screenshot". They work by passing the raw HTML source code (including stylesheets) to an internal parsing engine that draws an image representing how the HTML page would be displayed in a browser. As you may know, the same page does not necessarily look the same in all browsers. So any solution is only going to be as good as the parsng and drawing logic. If you really want to build your own HTML parsing logic - go for it. Quote Link to comment Share on other sites More sharing options...
White_Lily Posted November 20, 2012 Author Share Posted November 20, 2012 (edited) No, as i said at the beginning and end of my last post I want to write the script MYSELF not have someone else to write it for me, because then i would have to pay them, and i dont feel like being that generous. so in actual fact you are 0% clear. All I wanted to know was 1) is it possible (to which you replied yes and said it is not easy) 2) How would i go about it? Thats all I would have needed to know. EDIT: Psycho, I'm not to bothered how long really, it's more of a personal project rather than a client thing. But my boss said that it could be added to our list of functionalities if I could get it working. Edited November 20, 2012 by White_Lily Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 20, 2012 Share Posted November 20, 2012 No, as i said at the beginning and end of my last post I want to write the script MYSELF not have someone else to write it for me, because then i would have to pay them, and i dont feel like being that generous. so in actual fact you are 0% clear. All I wanted to know was 1) is it possible (to which you replied yes and said it is not easy) 2) How would i go about it? Thats all I would have needed to know. There are many ways to go about it. One of which I posted: html2canvas Quote Link to comment Share on other sites More sharing options...
White_Lily Posted November 20, 2012 Author Share Posted November 20, 2012 That site appears to supply the code for me, where's the learning factor in that? If there is maybe a simple tutorial you know, that would help me. Quote Link to comment Share on other sites More sharing options...
Adam Posted November 20, 2012 Share Posted November 20, 2012 https://github.com/raphaelcruzeiro/webimage Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 20, 2012 Share Posted November 20, 2012 Download the code and study the ins and outs. Reverse-engineering code is how I started learning PHP in the first place. But your needs sounds extremely specific, so perhaps you should just spend some time searching the Google machine yourself. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 20, 2012 Share Posted November 20, 2012 (edited) EDIT: Psycho, I'm not to bothered how long really, it's more of a personal project rather than a client thing. But my boss said that it could be added to our list of functionalities if I could get it working. Not to be demeaning, but that is ridiculous. Is your company's business based on taking "screenshots" of websites? If no, why would you go through the expense of creating such a thing when you can buy a solution for less than it would cost to build one? Plus, with a solution you buy there are many other people using the solution. So bugs are found quicker and the company providing the solution has a vested interest in updating and maintaining the solution. The bottom line is that it will not be cost effective for you to build your own solution and I will guarantee it will have bugs because of the sheer complexity you would encounter in web pages. But, if your company thinks it is worthwhile, sure, what the heck. Job security, right. Edited November 20, 2012 by Psycho Quote Link to comment Share on other sites More sharing options...
Adam Posted November 21, 2012 Share Posted November 21, 2012 Psycho mate, I have to disagree here. I think White_Lily was just saying he wanted to create something like this, and if it came to anything, way hey his boss will use -- White_Lily I would not agree to that, I would bill him for all the hours you spent putting it together. This is a solved problem though. There's plenty of solutions out there to generate relatively high-quality images based on the webkit engine or other libraries, in a variety of languages. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted November 21, 2012 Share Posted November 21, 2012 I made the exact thing you are looking for and did lots of experimenting along the way. http://dynaindex.com/snapshot.php Take a look at these 2 posts for what I suggested in the past and links to information about it. http://forums.phpfreaks.com/topic/261536-screenshot-software-for-windows-your-recs/?do=findComment&comment=1340333 http://www.phpfreaks.com/forums/index.php?topic=352033.msg1662293#msg1662293 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.