From the developer of TagIt! Tagboard, DeadlySin3 dot Net brings to you ScrotIt! Screencapture! Written for Linux and similiar systems, ScrotIt! Screencapture requires SCROT to be installed on your system.
By : DeadlySin3
ScrotIt! Screencapture v0.1.A
Tested with: PHP 4.3.10-16 (cli) (built: Aug 24 2005 20:25:01) on Debian.Sarge v3.1 and PHP 4.4.2-1+b1 (cli) (built: Mar 20 2006 03:48:19) on Debian.Sid
Notes: This is my first attempt at creating a php command line interface to a program called "scrot".
Official Website: http://linuxbrit.co.uk/scrot/ Install using apt-get: # apt-get install scrot
scrot is required in order to run this script!
Description: command line screen capture utility scrot (SCReen shOT) is a simple commandline screen capture utility that uses imlib2 to grab and save images. Multiple image formats are supported through imlib2's dynamic saver modules.
Purpose: I wrote this user interface for scrot to make taking a screen capture and uploading it to your website as easy as possible. With a single command on a shell, scrot captures an image and the php script I wrote uploads the image via FTP to a remote host.
Command: user@localhost:~$ php -f .take
Script Configuration: Open inc.shot.php in an editor and set up the basics. Drop all scripts in this download into your home directory. ex. /home/paul/
Or whichever directory you choose. I reccomend not keeping this program in a www accessible directory.
The reason for this is simple. Hiding the script keeps it out of view, for the most part, keeping your directory "clean".
If you installed:
in your own home directory, you simply open a terminal emulator (x-term, e-term, p-term, k-term, rxvt, etc) and type the following:
php -f .take
anywhere else, type:
php -f /path/to/script/.take
(the "-f" option is optional - it may be omitted)
And you're done. In a moment, your desktop image will be taken and uploaded!
UploadIt! is not meant as a web application. If you manage to use it as one, do let me know!
e-mail: deadlysin3 at gmail dot com
Using "alias" to make this even easier!
user@localhost:~$ alias take='php -f .take'
Then simply type "take" on a shell.
TO DO: ------
I'm thinking about developing a way to allow users of your website to click a link, and have an online php script call home to your machine and execute the command to take and upload a screenshot. I'm not sure how I can do it but that's why I'm thinking about it! Feel free to send ideas and suggestions to : deadlysin3 at gmail dot com
------- CODE -------
<?php
# #.inc.shot #
### Directory on remote server to store image $ftproot = "/public_html";
### Directory on localhost to store image $srcroot = "/home/paul/public_html/shots";
### Name to save image as (*.jpg, *.jpeg, *.png) etc $pic_name = "currentDesktop.jpeg"; $destination_file = "$ftproot/$pic_name"; $source_file = "$srcroot/$pic_name";
### Set up connection $ftp_server = "ftp.site.net"; $ftp_user_name = "anonymous@localhost"; $ftp_user_pass = ""; $conn_id = ftp_connect($ftp_server);
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.