Skip to content

Commit

Permalink
rename class to PosterEditor and update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
antonlukin committed Apr 26, 2021
1 parent 29a2648 commit 62ba2bd
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 91 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Poster Image
# Poster Editor

This class is an alternative to the package [Intervention Image](https://github.com/Intervention/image) for more flexible work with text on the image.
Use it if you need to **fit text** in a given area, automatically **calculate font size** and change **line height**.
Expand All @@ -12,10 +12,10 @@ Note that this class supports PHP-GD driver only.
You can also easily inherit your class — all methods of the parent can be overridden.

## Installation
The best way to install Poster Image is quickly and easily with [Composer](http://getcomposer.org/).
The best way to install Poster Editor is quickly and easily with [Composer](http://getcomposer.org/).
However, you can require the class directly without using a loader - this will not affect performance in any way.

`php composer.phar require antonlukin/poster-image`
`php composer.phar require antonlukin/poster-editor`

## Usage
In case of an error, the class methods return an exception.
Expand All @@ -27,10 +27,10 @@ Therefore, it is best to call them inside a block `try..catch`.
require_once __DIR__ . '/vendor/autoload.php';

// Or directly
// require_once __DIR__ . '/PosterImage.php';
// require_once __DIR__ . '/PosterEditor.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();
$image->make('images/bridge.jpg')->fit(600, 600);
$image->show();

Expand All @@ -41,4 +41,4 @@ try {

## Contribution
All project code is stored on Github. The best way to help the project is to report a bug or add some new functionality.
You can also open here an [issue](https://github.com/antonlukin/poster-image/issues) or send a [pull reguest](https://github.com/antonlukin/poster-image/pulls).
You can also open here an [issue](https://github.com/antonlukin/poster-editor/issues) or send a [pull reguest](https://github.com/antonlukin/poster-editor/pulls).
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "antonlukin/poster-image",
"version": "2.3",
"name": "antonlukin/poster-editor",
"version": "3.0",
"description": "Wrapper for PHP's GD Library for easy image manipulation",
"keywords": ["php", "image", "text", "gd"],
"homepage": "https://github.com/antonlukin/poster-image",
"homepage": "https://github.com/antonlukin/poster-editor",
"type": "library",
"license": "MIT",
"authors": [
Expand All @@ -24,7 +24,7 @@
},
"autoload": {
"files": [
"src/PosterImage.php"
"src/PosterEditor.php"
]
}
}
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions example/append.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();
$image->make('images/bridge.jpg')->fit(600, 300, 'top');

$logo = new PosterImage\PosterImage();
$logo = new PosterEditor\PosterEditor();
$logo->make('images/logo.png')->resize(300, 50)->grayscale();

$image->append($logo)->show();

} catch(Exception $e) {
echo $e->getMessage();
}
}
8 changes: 4 additions & 4 deletions example/blackout.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image and fit to 1200x630 area.
$image->make('images/bridge.jpg')->fit(1200, 630);
Expand All @@ -40,4 +40,4 @@

} catch(Exception $e) {
echo $e->getMessage();
}
}
8 changes: 4 additions & 4 deletions example/blur.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();
$image->make('images/bridge.jpg')->blur();

$image->show();

} catch(Exception $e) {
echo $e->getMessage();
}
}
8 changes: 4 additions & 4 deletions example/canvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create canvas.
$image->canvas(500, 500);
Expand All @@ -30,4 +30,4 @@

} catch(Exception $e) {
echo $e->getMessage();
}
}
10 changes: 5 additions & 5 deletions example/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image.
$image->make('images/bridge.jpg');

// Set filters.
$image->blur(2)->contrast(25)->brightness(-10);
$image->contrast(25)->brightness(-10);

// Show it.
$image->show();

} catch(Exception $e) {
echo $e->getMessage();
}
}
12 changes: 5 additions & 7 deletions example/insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image and crop 600x600 area.
$image->make('images/bridge.jpg')->fit(600, 600, 'bottom-right');
Expand All @@ -24,9 +24,7 @@
$image->insert(
'images/logo.png',
array(
'x' => '10%',
'y' => '10%',
'width' => 200,
'width' => 500,
)
);

Expand All @@ -35,4 +33,4 @@

} catch(Exception $e) {
echo $e->getMessage();
}
}
8 changes: 4 additions & 4 deletions example/resize.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image and resize it down.
$image->make('images/bridge.jpg')->resize(300, 500, false);
Expand All @@ -23,4 +23,4 @@

} catch(Exception $e) {
echo $e->getMessage();
}
}
8 changes: 4 additions & 4 deletions example/resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image and fit 600x600 area.
$image->make('images/bridge.jpg')->fit(600, 600);
Expand All @@ -32,4 +32,4 @@

} catch(Exception $e) {
echo $e->getMessage();
}
}
6 changes: 3 additions & 3 deletions example/shapes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image and fit it from bottom.
$image->make('images/bridge.jpg')->fit(1000, 630, 'bottom');
Expand Down
10 changes: 5 additions & 5 deletions example/text-boundary.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image and crop 900x600 left-bottom area.
$image->make('images/bridge.jpg')->crop(
900, 600,
array(
'x' => '0',
'y' => '100%'
'y' => '100'
)
);

Expand Down Expand Up @@ -62,4 +62,4 @@

} catch(Exception $e) {
echo $e->getMessage();
}
}
8 changes: 4 additions & 4 deletions example/text-center.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* php version 7.1
*
* @category PHP
* @package PosterImage
* @package PosterEditor
* @author Anton Lukin <anton@lukin.me>
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @link https://github.com/antonlukin/poster-image
* @link https://github.com/antonlukin/poster-editor
*/

require_once __DIR__ . '/../vendor/autoload.php';

try {
$image = new PosterImage\PosterImage();
$image = new PosterEditor\PosterEditor();

// Create from image and fit 1200x630 area.
$image->make('images/bridge.jpg')->fit(1200, 630);
Expand Down Expand Up @@ -42,4 +42,4 @@

} catch(Exception $e) {
echo $e->getMessage();
}
}
Loading

0 comments on commit 62ba2bd

Please sign in to comment.