Skip to content

Commit bf8ce85

Browse files
committed
v1.0
1 parent 462f633 commit bf8ce85

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Params/MakeParams.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ public function setElementId($id) {
6969
* Scale setter
7070
* @param $height
7171
* @param $width
72+
* @param $smart boolean
7273
* @throws Screenshots\Exception
7374
*/
74-
public function addScale($height, $width) {
75+
public function addScale($height, $width, $smart = false) {
7576
if (is_numeric($height) && is_numeric($width)) {
7677
$this->_scales[] = [
77-
'w' => $width ,
78-
'h' => $height
78+
'w' => $width ,
79+
'h' => $height,
80+
'smart' => (boolean)$smart
7981
];
8082
} else {
8183
throw new Screenshots\Exception("Incorrect height or width value");

README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Cagoi screenshots
1+
Cagoi screenshots v1.0
22
=================
33

44
Library for an easy screenshots making
@@ -55,6 +55,7 @@ $params = new Cagoi\Screenshots\Params\MakeParams('https://google.com');
5555
$params->setCallback("http://my.site.com/callback");
5656
$creator = Cagoi\Screenshots\ImageCreator();
5757
$creator->add('full', '<path to save>', '<filename>');
58+
// Send the task
5859
$client->makeScreenshot($params, $adapter, $creator);
5960
```
6061

@@ -67,8 +68,10 @@ $params = new Cagoi\Screenshots\Params\MakeParams('https://google.com');
6768
$params->setCallback("http://my.site.com/callback");
6869
// Element id setter
6970
$params->setElementId("<element id>");
71+
// Saver for ready files
7072
$creator = Cagoi\Screenshots\ImageCreator();
7173
$creator->add('full', '<path to save>', '<filename>');
74+
// Send the task
7275
$client->makeScreenshot($params, $adapter, $creator);
7376
```
7477

@@ -90,6 +93,8 @@ $params->addWidthScale(300);
9093
$params->addHeightScale(300);
9194
// Set scale width = 300px, height = 300px
9295
$params->addScale(300, 300);
96+
// Set scale width = 300px, height = 900px + turn 'smart' resizing on (last parameter)
97+
$paramsObj->addScale(300, 900, true);
9398

9499
$creator = Cagoi\Screenshots\ImageCreator();
95100
// Create full image
@@ -100,15 +105,15 @@ $creator->add('300x0', '<path to save>', '<filename>');
100105
$creator->add('0x300', '<path to save>', '<filename>');
101106
// Create image with width = 300px, height = 300px
102107
$creator->add('300x300', '<path to save>', '<filename>');
108+
// Create image with width = 300px, height = 900px + 'smart' resizing turned on
109+
$imageCreatorObj->add('smartx300x900', $params['filePath'], '<filename>');
110+
// Send the task
103111
$client->makeScreenshot($params, $adapter, $creator);
104112
```
105113

106114
```php
107-
// Using logger
115+
// Logger usage
108116
$client = new Cagoi\Screenshots\Client('http://server.com', 'clientKey');
109117
$client->setLogger(new Cagoi\Screenshots\Logger\FileLogger("<path to logs directory>"));
110118
...
111119
```
112-
113-
114-

0 commit comments

Comments
 (0)