tag:blogger.com,1999:blog-865923359735383241.post971412990484451237..comments2023-10-29T07:27:09.012-06:00Comments on Ccna final exam - java, php, javascript, ios, cshap all in one: Website screenshots using PHPUnknownnoreply@blogger.comBlogger18125tag:blogger.com,1999:blog-865923359735383241.post-86465233114030624142012-05-31T19:36:03.438-06:002012-05-31T19:36:03.438-06:00Guys, just use script bellow
<?php
echo '...Guys, just use script bellow<br /><br /><?php<br />echo '<script language="javascript" src="http://www.bildesel.de/thumb.php?url='.urlencode($url).'"></script>';<br />?>Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-13878743757256748592012-05-31T19:36:02.177-06:002012-05-31T19:36:02.177-06:00Try GrabzIt they have a great API and thier servic...Try GrabzIt they have a great API and thier service is very fast. I use it on one of my personal websites.<br /><br />Also because they use a callback when the screenshot is finished you don't have to continously poll them like you do for thumbilizer.<br /><br />They have simple instructions on their website, to request a screenshot be taken:<br /><br />include("GrabzItClient.class.php");<br /><br />//Create the GrabzItClient class<br />//Replace "APPLICATION KEY", "APPLICATION SECRET" with the values from your account!<br />$grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");<br />//Take the picture the method will return the unique identifier assigned to this task<br />$id = $grabzIt->TakePicture("http://www.google.com", "http://www.example.com/GrabzItHandler.php");<br /><br /><br />Then to save that screenshot create a PHP page to accept the screenshot result:<br /><br />include("GrabzItClient.class.php");<br /><br />$message = $_GET["message"];<br />$customId = $_GET["customid"];<br />$id = $_GET["id"];<br />$filename = $_GET["filename"];<br /><br />$grabzIt = new GrabzItClient("APPLICATION KEY", "APPLICATION SECRET");<br />$result = $grabzIt->GetPicture($id);<br /><br />if (!$result)<br />{<br />return;<br />}<br /><br />//Ensure that the application has the correct rights for this directory.<br />file_put_contents("images" . DIRECTORY_SEPARATOR . $filename, $result);Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-87017294524930433472012-05-31T19:36:01.538-06:002012-05-31T19:36:01.538-06:00You can use wimg.ca
example: http://wimg.ca/http:...You can use wimg.ca<br /><br />example: http://wimg.ca/http://stackoverflow.com/questions/757675/website-screenshots-using-php<br /><br />:DUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-56106764050393374782012-05-31T19:36:00.759-06:002012-05-31T19:36:00.759-06:00Yes it is. If you only need image of URL try this
...Yes it is. If you only need image of URL try this<br /><br /><img src='http://zenithwebtechnologies.com.au/thumbnail.php?url=www.subway.com.au'><br /><br /><br />Pass the url as argument and you'll get the image for more details check this link http://zenithwebtechnologies.com.au/auto-thumbnail-generation-from-url.htmlUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-65665147635164742742012-05-31T19:35:59.377-06:002012-05-31T19:35:59.377-06:00I used bluga. The api allows you to take 100 snap...I used bluga. The api allows you to take 100 snapshots a month without paying, but sometimes it uses more than 1 credit for a single page. I just finished upgrading a drupal module, Bluga WebThumbs to drupal 7 which allows you to print a thumbnail in a template or input filter. <br /><br />The main advantage to using this api is that it allows you to specify browser dimensions in case you use adaptive css, so I am using it to get renderings for the mobile and tablet layout as well as the regular one.<br /><br />There are api clients for the following languages:<br /><br />PHP,<br />Python,<br />Ruby,<br />Java,<br />.Net C#,<br />Perl<br />and Bash (the shell script looks like it requires perl)Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-50539606949925252092012-05-31T19:35:58.641-06:002012-05-31T19:35:58.641-06:00I modified webshot, it can be run from PHP with ex...I modified webshot, it can be run from PHP with exec https://github.com/umpirsky/webshotUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-41052879581497677152012-05-31T19:35:57.729-06:002012-05-31T19:35:57.729-06:00webkit2html works on Mac OS X and Linux, is quite ...webkit2html works on Mac OS X and Linux, is quite simple to install and to use. See this tutorial.<br /><br />For Windows, you can go with CutyCapt, which has similar functionality.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-62449376657511053262012-05-31T19:35:56.999-06:002012-05-31T19:35:56.999-06:00Try this:
http://www.websnapr.com/Try this:<br />http://www.websnapr.com/Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-29702724147017327182012-05-31T19:35:55.559-06:002012-05-31T19:35:55.559-06:00Shrink the web has always been what I've used....Shrink the web has always been what I've used. I think they have a nice API.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-57829161803948705602012-05-31T19:35:54.441-06:002012-05-31T19:35:54.441-06:00I'm on Windows so I was able to use the imageg...I'm on Windows so I was able to use the imagegrabwindow function after reading the tip on here from stephan. I added in cropping (to get rid of the Browser header, scroll bars, etc.) and resizing to get a final image. Here's my code. Hope that helps someone.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-76833934704915555542012-05-31T19:35:53.841-06:002012-05-31T19:35:53.841-06:00I've been digging for something that can handl...I've been digging for something that can handle this and I came across this simple PHP class that's absolutely amazing!<br /><br />https://github.com/mptre/thumbalizrUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-60476359814723374502012-05-31T19:35:52.754-06:002012-05-31T19:35:52.754-06:00Not directly. Software such as Selenium have featu...Not directly. Software such as Selenium have features like this and can be controlled by PHP but have other dependencys (such as running their java-based server on the computer with the browser you want to screenshot)Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-80667496143136969032012-05-31T19:35:52.137-06:002012-05-31T19:35:52.137-06:00A website has to be rendered. PHP does not have we...A website has to be rendered. PHP does not have website (HTML, CSS, JavaScript, etc) rendering capabilities. So no.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-80879032277227278002012-05-31T19:35:51.358-06:002012-05-31T19:35:51.358-06:00Yes. You will need some things tho:
See khtmld(ae...Yes. You will need some things tho:<br /><br />See khtmld(aemon) on *nx.<br />See Url2Jpg for Windows but since it is dotNet app you should also chek Url2Bmp<br /><br />Both are console tools that u can utilise from your web app to get the screenshot.<br /><br />There are also web services that offer it. Check this out for example.<br /><br />Edit:<br /><br />This link is useful to.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-30948892561054272322012-05-31T19:35:50.774-06:002012-05-31T19:35:50.774-06:00It's in Python, but going over the documentati...It's in Python, but going over the documentation and code you can see exactly how this is done. If you can run python, then it's a ready-made solution for you:<br /><br />http://browsershots.org/ <br /><br />Note that everything can run on one machine for one platform, or one machine with virtual machines running the other platforms.<br /><br />Free, open source, scroll to bottom of page for links to documentation, source code, and other information.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-38794483082823256682012-05-31T19:35:49.647-06:002012-05-31T19:35:49.647-06:00This ought to be good for you:
http://code.google...This ought to be good for you:<br /><br />http://code.google.com/p/wkhtmltopdf/<br /><br />Make sure you download the wkhtmltoimage distribution!Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-23924735846105090222012-05-31T19:35:48.776-06:002012-05-31T19:35:48.776-06:00Since PHP 5.2.2 it is possible, to capture a websi...Since PHP 5.2.2 it is possible, to capture a website with PHP solely!<br /><br /><br /> imagegrabscreen — Captures the whole screen<br /><br /><br /><?php<br />$img = imagegrabscreen();<br />imagepng($img, 'screenshot.png');<br />?><br /><br /><br /><br /> imagegrabwindow - Grabs a window or its client area using a windows handle (HWND property in COM instance) <br /><br /><br /><?php<br />$Browser = new COM('InternetExplorer.Application');<br />$Browserhandle = $Browser->HWND;<br />$Browser->Visible = true;<br />$Browser->Fullscreen = true;<br />$Browser->Navigate('http://www.stackoverflow.com');<br /><br />while($Browser->Busy){<br /> com_message_pump(4000);<br />}<br /><br />$img = imagegrabwindow($Browserhandle, 0);<br />$Browser->Quit();<br />imagepng($img, 'screenshot.png');<br />?><br /><br /><br />Edit: Note, these functions are available on Windows systems ONLY!Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-56465137249184280472012-05-31T19:35:45.763-06:002012-05-31T19:35:45.763-06:00Sure you can, but you'll need to render the pa...Sure you can, but you'll need to render the page with something.<br />If you really want to only use php, i suggest you HTMLTOPS, wich render the page and output it in a ps file (ghostscript), then, convert it in a .jpg, .png, .pdf.. can be little slower with complex pages (and dont support all the CSS).<br /><br />Else, you can use wkhtmltopdf to output a html page in pdf, jpg, whaterver..<br />Accept CSS2.0, use the webkit (safari's wrapper) to render the page.. so should be fine.<br />You have to install it on your server, as well..<br /><br />UPDATE Now, with new HTML5 and JS feature, is also possible to render the page into a canvas object using Javascript. Here a nice library to do that: Html2Canvas and here an implementatio by the same author to get a feedback like G+.<br />Once you have rendered the dom into the canvas, you can then send to the server via ajax and save it as a jpg.<br /><br />EDIT: You can use the imagemagick tool for transforming pdf to png. My version of wkhtmltopdf does not support images. E.g. convert html.pdf -append html.png.<br /><br />EDIT: This small shell script gives a simple / but working usage example on linux with php5-cli and the tools mentioned above. <br /><br />EDIT: i noticed now that the wkhtmltopdf team is working on another project: wkhtmltoimage, that gives you the jpg directlyUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.com