2017 © Pedro Peláez
 

library imageartist

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

image

treinetic/imageartist

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  • Monday, November 27, 2017
  • by imalhasaranga
  • Repository
  • 2 Watchers
  • 14 Stars
  • 1,635 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 9 Open issues
  • 14 Versions
  • 60 % Grown

The README.md

ImageArtist 1.0.0

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php, (*1)

This project is an initiative of Treinetic (Pvt) Ltd, Sri Lanka. Contact us via info@treinetic.com and get your project done by the experts., (*2)

Issues Software License Forks Stars Twitter, (*3)

Requirements

PHP 5.0 >, (*4)

Optional ( Consider installing imagick along with pango for complex unicode Texts ) - Imageick with Pango, (*5)

Install

The package can be installed via composer: ``` bash $ composer require treinetic/imageartist, (*6)


## Usage ( Let's Dive In ) ### Very Basics * Load Image, Most of the Classes Extends the Image class so if you know how to load an Image then you know how to use most of the library classes ```php $image = new Image("./morning.jpeg");

Note : Remember to import ( use ) the class first, see demo folder for more complete code., (*7)

  • Image Resizing
$image->scale(40); //scales the image 40%
$image->scaleToHeight(1024); //scales the image keeping height 1024
$image->scaleToWidth(1024); //scales the image keeping width 1024
$image->resize(1024,768); //resizes the image to a given size 

  • Image Attributes
$new_wdith = $image->getWidth();
$new_height = $image->getHeight();
  • Change Format/ Save to Disk
$image->convertTo(IMAGETYPE_PNG);
$image->save("./newImage.jpg",IMAGETYPE_PNG);
  • Orientation
$image->rotate(50); 
$image->flipV(); // Vertical Flip
$image->flipH(); // Horizontal Flip
  • Other Usefull Operations
$base64URL = $image->getDataURI();
/* 
    Image class will return itself for following methods but in Shape classes it will be a new Image 
    to keep the idea of Shape Consistant
 */
$image->crop(100,100,300,300);
$image->merge(new Image("./city.jpg"),10,10);

Awesome Stuff

Lets do some things that matter, (*8)

  • Create a shape, for creating a custom shape you can directly use Either CircularShape.php or PolygonShape.php however if you are looking for a standard shape which is not yet existing then still you can use either CircularShape.php or PolygonShape.php to create them but we encorage you to contribute to the project by adding those shape
  • Lets Create a Triangle ( There are few other Pre made shapes for your use )
$triangle = new Triangle("./city.jpg");
$triangle->scale(60);
$triangle->setPointA(20,20,true); //setting point A, i'm using preentages but you can use px as well
$triangle->setPointB(80,20,true);
$triangle->setPointC(50,80,true);
$triangle->build();

, (*9)

  • Create Create Custom Shape, lets see how we can make a nice Pentagon
$pentagon = new PolygonShape("./morning.jpeg");
$pentagon->scale(60);
$pentagon->push(new Node(50,0, Node::$PERCENTAGE_METRICS));
$pentagon->push(new Node(75,50, Node::$PERCENTAGE_METRICS));
$pentagon->push(new Node(62.5,100, Node::$PERCENTAGE_METRICS));
$pentagon->push(new Node(37.5,100, Node::$PERCENTAGE_METRICS));
$pentagon->push(new Node(25,50, Node::$PERCENTAGE_METRICS));
$pentagon->build();

, (*10)

  • Lets Merge Two Triangles
$tr1 = new Triangle("./city.jpg");
$tr1->scale(60);
$tr1->setPointA(0,0,true);
$tr1->setPointB(100,0,true);
$tr1->setPointC(100,100,true);
$tr1->build();

$tr2 = new Triangle("./morning.jpeg");
$tr2->scale(60);
$tr2->setPointA(0,0,true);
$tr2->setPointB(0,100,true);
$tr2->setPointC(100,100,true);
$tr2->build();

$tr1->resize($tr1->getWidth(),$tr2->getHeight());

$img = $tr1->merge($tr2,0,0);
$img->scale(70);

, (*11)

  • Let's Do Some Photoshop Shall we ? Create a Facebook cover
/* Let's add an overlay to this */
$overlay = new Overlay($img->getWidth(),$img->getHeight(),new Color(0,0,0,80));
$img->merge($overlay,0,0);
/* hmmm.. lets add a photo */
$circle = new CircularShape("./person.jpg");
$circle->build();
$img = $img->merge($circle,($img->getWidth()-$circle->getWidth())/2,($img->getHeight() - $circle->getHeight())/2);
/* I think I should add some Text */
$textBox = new TextBox(310,40);
$textBox->setColor(Color::getColor(Color::$WHITE));
$textBox->setFont(Font::getFont(Font::$NOTOSERIF_REGULAR));
$textBox->setSize(20);
$textBox->setMargin(2);
$textBox->setText("We Are Team Treinetic");
$img->setTextBox($textBox,($img->getWidth()-$textBox->getWidth())/2,$img->getHeight()* (5/7));

$img->dump(); //development purposes only

, (*12)

Change log

Please see CHANGELOG for more information what has changed recently., (*13)

Contributing

Please see CONTRIBUTING for details., (*14)

Credits

License

The MIT License (MIT). Please see License File for more information., (*15)

The Versions

27/11 2017

dev-master

9999999-dev

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-gd *

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

24/09 2017

dev-1.0.0-rc

dev-1.0.0-rc

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

24/09 2017

1.0.0

1.0.0.0

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

24/09 2017

0.3.1

0.3.1.0

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

24/09 2017

dev-0.3.1-beta-rc

dev-0.3.1-beta-rc

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

13/09 2017

dev-0.3.0-alpha-rc

dev-0.3.0-alpha-rc

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

13/09 2017

0.3.0

0.3.0.0

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

13/09 2017

0.2.1

0.2.1.0

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

13/09 2017

dev-0.2.0-alpha-rc

dev-0.2.0-alpha-rc

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

12/09 2017

0.2.0

0.2.0.0

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

10/09 2017

0.1.0-alpha

0.1.0.0-alpha

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

10/09 2017

dev-0.1.0-alpha-rc

dev-0.1.0-alpha-rc

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

10/09 2017

dev-images

dev-images

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Imal hasaranga

scale image image merge gd made easy php gd wrapper easy gd wrapper image shape crop image to base64 write text on image

08/09 2017

0.0.1-alpha

0.0.1.0-alpha

drawing using php gd

  Sources   Download

MIT

by Imal hasaranga