This is simple script to demonstrate the capabilities of PHP with the GD library, which provides a lot of image functions that can be useful in many applications. GD provides a rich set of functions. For a complete list of these functions, check the PHP manual.
header('Content-Type: image/png');// Text to be converted to image$text='Hello World';// Font to use, give accessible path from script$font='./arial.ttf';// Convert HTML entities into ISO-8859-1$text=html_entity_decode($text,ENT_NOQUOTES,"ISO-8859-1");// Create the image$im=imagecreatetruecolor(160,160);$white=imagecolorallocate($im,255,255,255);$black=imagecolorallocate($im,0,0,0);// Create some colorsimagefilledrectangle($im,0,0,160,80,$white);// Add the textimagettftext($im,12,0,20,20,$black,$font,$out);imagepng($im);imagedestroy($im);exit;
// Text to be converted to image
$text = 'Hello World';
// Font to use, give accessible path from script
$font = './arial.ttf';
// Convert HTML entities into ISO-8859-1
$text = html_entity_decode($text,ENT_NOQUOTES, "ISO-8859-1");
// Create the image
$im = imagecreatetruecolor(160, 160);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// Create some colors
imagefilledrectangle($im, 0, 0, 160, 80, $white);
// Add the text
imagettftext($im, 12, 0, 20, 20, $black, $font, $out);
GD can also be used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM.
I’m always confused with the use of ‘exclude’ options with ‘tar’. Here I’m sharing a few tips I found online, just in case it might help you. The meanings of –exclude and –exclude-from are always confusing:
Use –exclude when files to be excluded are given as a pattern on the command line.
Use –exclude-from to introduce the name of a file which contains a list of patterns, one per line; each of these patterns can exclude zero, one, or many files.
When using –exclude=pattern, be sure to quote the pattern parameter, so GNU tar sees wildcard characters like ‘*’.
$ tar -c -f <em>archive.tar</em> --exclude '*.o' <em>directory</em>
tar does not act on a path name explicitly listed on the command line if one of its file name components is excluded. If files that end with ‘*.o’ are excluded when creating an archive, but explicitly name the file ‘dir.o/foo’ after all the options have been listed, ‘dir.o/foo’ will be excluded from the archive.
Only shell syntax, or globbing will work with exclude options in tar. The command might fail if regexp syntax is used to describe files to be excluded in the command.
Problem (I had): Wanted to run a VirtualBox on a RHEL 4.7 Linux server which is shared by someothers. But as some other processes took more CPU, the VirtualBox performance was bad. So I wanted to increase the priority given to VirtualBox.
Solution (I found): VirtualBox can be given higher priority using nice command. Also renice command can be used to change the priority of a running process, which will also be useful.
nice -10 VBoxHeadless
Gives the VBoxHeadless process 1.5 times priority than the normal process, calculated as (20 – -10)/20 = 1.5
nice -20 make
Executes make at maximum priority.
renice +20 2222
Changes the priority of process 2222 to +20 (minimum priority).
renice -10 -p 13013
Changes the priority of a running process by specifying its process ID, where priority can be,
1 to 20 :Â Runs the specified processes slower than the base priority.
0 :Â Sets priority of the specified processes to the base scheduling priority.
-20 to -1 :Â Runs the specified processes quicker than the base priority.
The popular multiplatform media player VLC Media Player says Merry Christmas to all users this festive season by putting a red Christmas hat icon. This is an Easter egg in the latest version of VLC media player, and those who have the updated version will notice this at use.