-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-gd.php
More file actions
55 lines (38 loc) · 1.2 KB
/
test-gd.php
File metadata and controls
55 lines (38 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
//header('Content-type: text/plain');
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
$img = '/home/pi/www/media.esco.net/_httpdocs/img/social/1/photos/mixer2_0_44632360e3dd77602253_o.jpg';
$img = '/home/pi/www/media.esco.net/test.jpg';
header('Content-type: image/jpg');
// GD VERSION
// Create a new image
$newImage = imagecreatetruecolor(700, 466); // Destination image
// Extract from source image
$sourceImage = imagecreatefromjpeg($img);
// Copy from the source image on to the new image, cropping.
imagecopyresampled($newImage, $sourceImage, 0, 0, 0, 0, 700, 466, 5184, 3456);
//header('Content-type: text/plain');
imagejpeg($newImage, null, 90);
die();
/*
IMAGIK
$image = new Imagick( $img );
$image->adaptiveResizeImage(1500, 999);
$image->resizeImage(700, 466, imagick::FILTER_TRIANGLE, 1);
$image->sharpenimage(1,4);
$image->setImageCompressionQuality(90);
//$image->resizeImage(1000, 666, imagick::FILTER_POINT, 8);
//$image->sharpenimage(1,4);
*/
//
//die($image);
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo "Render time: $total_time";
die();