MyGraphics is a simple PHP graphics class that will allow you to create images with PHP.
The documentation can be found here and will be updated as much as possible. It is free to use and some examples how to use it can be seen below.
Load image from URL
You can store a image from a URL and change it and apply effects, resize and so on.
include("graphics.class.php");
You must first include the class within your program or script.
Now using a static method from the graphics class. You can then load the image into a variable, which will be returned as a Graphics object, which will give you access to the methods.
$image = Graphics::createToObject("http://");
Now you can simply show and set the header for the image to display.
$image->setHeader("png");
$image->show();
The image will now be displayed. Of course you can apply effects by using something like the following code.
$image->emboss();
This will emboss your image. You can view all the possible methods and effects within the documentation provided above.
When the imboss is applied, it is turn’t into the image below.
Creating a Pie Chart
You can create a pie chart on images also. We can take the image above and draw a pie chart onto it.
include("includes/graphics.class.php");
$image = Graphics::createToObject("IMAGE HERE");
$image->drawPieChart(array(10,20,30,40));
$image->setHeader("png");
$image->show();
We simply run the drawPieChart() method, which takes an array as its parameter.
$image->drawPieChart(array(10,20,30,40));
This will plot a pie chart onto the image.
You can also make a bar chart (very simply).
$image->drawBarGraph(array(10,20,30,40,50.60,70,80,90,100), 30);
You supply an array of values and also a width that the bars will be.
Inverting Colours
You can create such things as inverted rectangles onto images.
$image->drawRectangleInvert(0, 50, 200, 150, $image->setColour(0, 0, 0));
How to download
You can download the code here. This will be updated as much as possible with re-factored code and more methods.





