Author Archives: Silver Moon

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

PHP best way to check if file is an image

By | October 23, 2011

The getimagesize function of php provides lot of information about an image file , including its type. The type can be used to check if the file is a valid image file or not. To check if a file is an image or not, use the function function is_image($path) { $a = getimagesize($path); $image_type =… Read More »

PHP strtotime in 64 bit environment

By | October 23, 2011

The strtotime function is used to convert a date in various formats to a timestamp. However its behaviour is different based on architecture it is running on, whether 32bit or 64bit. Lets take a few examples : In 64 bit environment desktop:~$ php -a Interactive shell php > echo strtotime("0000-00-00 00:00:00"); -62170005200 php > echo… Read More »

Get domain whois information with telnet

By | May 2, 2013

Whois is often used to find out the details of the owners or the registrants of a domain name. The details includes name, address, telephone number etc. Whenever a domain is registered by a user, the user has to fill out own details at the domain registrar. These details are fed into the whois system,… Read More »

PHP benefits of storing session data in database

By | October 21, 2011

PHP’s session_start method stores the session data in files by default. These files are stored in the tmp directory of the OS and are cleared at intervals by the garbage collector. Alternatively the session data can be stored in database as well. Storing session data in database has certain advantages : 1. Limit the number… Read More »

Get smooth and beautiful fonts on Ubuntu

By | May 9, 2020

To get beautiful and smooth fonts on Ubuntu : 1. Install ttf-mscorefonts-installer from synaptic This will provide the fonts like microsoft arial , tahoma , verdana , courier etc. 2. Get the xml file by Obi Bok from The above xml file provides special finetuned settings for antialiasing and hinting parameters for various fonts… Read More »

Play VCD on Ubuntu

By | October 1, 2011

If Totem , the default movie player does not play vcds properly , showing file permission errors , then try : 1. SMPlayer Install from synaptic : sudo apt-get install smplayer 2. mplayer Install from synaptic : sudo apt-get install mplayer 3. KPlayer Install from synaptic : sudo apt-get install kplayer To play from terminal… Read More »

Display hindi unicode fonts on Google Chrome on Ubuntu Linux

By | September 29, 2011

Google Chrome has problem displaying hindi/unicode and other Indian language fonts. For example bold hindi fonts might be displayed as square boxes. It is some kind of font selection bug. Lets try fixing it. 1. You may want to install the packages ttf-devanagari-fonts and ttf-indic-fonts. Also get that mangal.ttf thing from windows or… Read More »

Convert vcd dat file to mpeg on ubuntu

By | September 28, 2011

VCDs that are played on vcd players often contain the video in dat format. The dat format is internally mpeg only but has some additional header information attached. So the mpeg portion has to be ripped off to get the mpeg format. Once converted to mpeg format, it can be processed inside any video editor…. Read More »

How to Resize large images in PHP with Imagemagick

By | May 1, 2023

Resizing images Web applications often need to work with images like pictures of users or photos etc. So the need to resize images comes up when creating thumbnails for example or compressing images for storage. The default library to handle image operations in php is GD. It can be used to resize images. GD vs… Read More »