Skip to content

Commit 5a860d7

Browse files
committed
Updated readme and removed gitignore
1 parent 92d7f34 commit 5a860d7

File tree

2 files changed

+24
-225
lines changed

2 files changed

+24
-225
lines changed

.gitignore

Lines changed: 0 additions & 224 deletions
This file was deleted.

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,25 @@ $image->save('image2.jpg');
8686

8787
This will cause your image to skew if you do not use the same width/height ratio as the source image.
8888

89+
Loading and saving images from string
90+
----------
91+
92+
To load an image from a string:
93+
94+
```php
95+
$image = ImageResize::createFromString(base64_decode('R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw=='));
96+
$image->scale(50);
97+
$image->save('image.jpg');
98+
```
99+
100+
You can also return the result as a string:
101+
102+
```php
103+
$image = ImageResize::createFromString(base64_decode('R0lGODlhDwAPAKECAAAAzMzM/////wAAACwAAAAADwAPAAACIISPeQHsrZ5ModrLlN48CXF8m2iQ3YmmKqVlRtW4MLwWACH+H09wdGltaXplZCBieSBVbGVhZCBTbWFydFNhdmVyIQAAOw=='));
104+
$image->scale(50);
105+
$result = $image->toString();
106+
```
107+
89108
Displaying
90109
----------
91110

@@ -126,7 +145,7 @@ $image->save('image2.jpg');
126145

127146
By default they are set to 75 and 0 respectively. See the manual entries for [`imagejpeg()`](http://www.php.net/manual/en/function.imagejpeg.php) and [`imagepng()`](http://www.php.net/manual/en/function.imagepng.php) for more info.
128147

129-
You can also pass the quality directly to the `save()` and `output()` methods:
148+
You can also pass the quality directly to the `save()`, `output()` and `toString()` methods:
130149

131150
```php
132151
$image = new ImageResize('image.jpg');
@@ -136,6 +155,10 @@ $image->save('image2.jpg', null, 100);
136155
$image = new ImageResize('image.jpg');
137156
$image->resizeToWidth(300);
138157
$image->output(IMAGETYPE_PNG, 4);
158+
159+
$image = new ImageResize('image.jpg');
160+
$image->scale(50);
161+
$result = $image->toString(IMAGETYPE_PNG, 4);
139162
```
140163

141164
We're passing `null` for the image type in the example above to skip over it and provide the quality. In this case, the image type is assumed to be the same as the input.

0 commit comments

Comments
 (0)