Skip to content

Posts from the ‘Uncategorized’ Category

12
Apr

Circle crop image with PHP imagick

To create a circular crop with ImageMagick PHP library we will draw a black circle that will be used as a mask for the original image.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// original image
$image = new Imagick('path_to_image');
 
// get width an height of the image
extract($image->getImageGeometry());
 
// create circle mask
$circle = new Imagick();
$circle->newImage($width, $height, '#fff');
$circle->setImageFormat('png');
$circle->setImageMatte(true);
$draw = new ImagickDraw();
$draw->setFillColor('#000');
$draw->circle(round($width / 2), round($height / 2), round($width / 2), $width);
$circle->drawImage($draw);
 
// apply mask
$image->compositeImage($circle, Imagick::COMPOSITE_SCREEN, 0, 0);
 
// save image
$image->writeImage('circle_image_path');
$image->destroy();
23
Jul

Install iostat on CentOS 6.6 Linux

We want to see IOPS for our hard drive. For this purpose we will use iostat. But there’s no iostat package, so we must find out the package name that contains iostat utility:

yum whatprovides "*/iostat"
sysstat-9.0.4-27.el6.x86_64 : The sar and iostat system monitoring commands
Repo        : base
Matched from:
Filename    : /usr/bin/iostat

So we need to install sysstat:

yum install sysstat

To see iops run:

iostat 1