Posted in: php,tip | ( 7 ) Comments
21 Jul 2011The following is a very short code to read the version number of a PDF document using PHP. I needed this recently during a PDF processing app developed in PHP. As Adobe uses different compression methods in various versions, it becomes necessary to be able to identify the version of the PDF under work.
Posted in: php,tip | ( 6 ) Comments
18 Jul 2011Frequently one needs to get the last few lines of some log files, whether php error logs or Apache logs. Most of these file sizes run into megabytes, which makes it difficult and time consuming to remotely open them using ftp. If you have shell access then you can easily use the *nix ‘tail’ command to return the last ‘n’ lines; or one can use the following if shell access is not enabled on your hosting.
function Tail($filename) { return system('tail -n 20 '.$filename); } |
Posted in: graphics,javascript,libraries,visualization | Comments Off
17 Jul 2011Posted in: data | Comments Off
8 Jul 2011During a recent project I needed a database of IATA airport codes. Airports around the world are universally known by a unique three-letter code: the “International Air Transport Association (IATA) Location Identifier”. It is much easier for pilots, travel agents, frequent flyers, baggage handlers and anyone having anything to do with airlines to say and write LGA then the full “New York, NY – La Guardia Airport“.
Posted in: algorithms,graphics,libraries | ( 5 ) Comments
6 Jul 2011In a previous post we saw how to detect human faces in images using JavaScript. In the current post we will look into a PHP port of a JavaScript face detection algorithm without using openCV. Since the code is completed written in PHP it cannot attain the raw speed that C,C++ provides, but for many trivial application a PHP version can do.
Posted in: php | Comments Off
30 Jun 2011Posted in: design,php,visualization | ( 6 ) Comments
19 Jun 2011
In the previous post we saw how we can generate a screenshot from a url. In this post we will see how we can create a color palette of the screenshot (or any other image for that matter) using PHP and GD. This can be useful if you need to quickly get the color scheme of a website or a image. Below are a few example images and their palettes generated using the program.
Posted in: libraries,php,tools | ( 17 ) Comments
15 Jun 2011
Taking screenshos of websites is not a frequent requirement for developers but can come handy on many occasions. Although there are some nice solutions on the web, a particular one I found very good is wkhtmltoimage.
wkhtmltoimage is a simple shell utility which can be used to convert html to images using the webkit rendering engine, and qt.
Posted in: browser,html,javascript | Comments Off
13 Jun 2011