Write a PHP function that generates a simple PNG image

  • Status Closed
  • Budget $30 - $250 USD
  • Total Bids 13

Project Description

I need a PHP function that I will use within Wordpress. This PHP function will generate a rectangular (760x450 pixel) PNG file (example attached). The file is a graphical representation of some datapoints. The function will be called with an array of data points and will create a "graph" of those data points appearing on a standard background. The function might use libraries such as described here ( [url removed, login to view] ). The function will be called "save_mood_graph(...)".


Below I show an example of the function and how it might be called from within Wordpress.

<---- Example code snippet below

$my_data_array = array(2,5,1,9,10,8,10,9,2,8,10,8,10);

$my_destination_file = "/tmp/[url removed, login to view]";

save_mood_graph($my_data_array, $my_destination_file); // should generate a PNG in the destination location

function save_mood_graph($data_array, $destination_file)


// Your code here



* The only dynmic part of the graph is the white dots and the white lines between the white dots (see example image). The rest is a static image.

* A maximimum of 13 points can be displayed.

* Horizontal spacing between points is always the same.

* If there are less than 13 points, the left side of the graph will be empty. For example, if there is only one point in the data array, it will appear on the right hand side of the graph.

* All values in the array will always be one of the numbers 1,2,3,4,5,6,7,8,9,10 (it will never be bigger than 10 or smaller than 1)

* If a file already exists in the same location as the $destination_file, go ahead and overwrite

* The example snippet above should create a graph that looks exactly like the example image attached to this work item.

* The code must be valid and callable from within Wordpress. Code will not be accepted until it is called successfully from my wordpress site so I will be asking the developer to put an example function call in my wordpress site to demonstrate that it works.


I have included 2 image examples. The first image shows what the desired output would be. The second image has some explanatory text laid on top to help clarify what I want done.

Get free quotes for a project like this
Awarded to:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online