Jump to content

PHP create image question


ashrobbins87

Recommended Posts

I have created an image in php and the size of it gets updated depending on a variable from my DB. I want to use it as a kind of totaliser, as it is displaying the amount of money that has been raised to date, therefore I want the image to start at the bottom and grow upwards. I know how to start it at the bottom of the canvas but I want to know how to draw the height of the image upwards, instead of it going down the page and off the bottom of the canvas.

 

Sorry if that explanation isnt very clear!!

//create the canvas
$image = ImageCreate(30, 400);

//set up colours
$blue = ImageColorAllocate($image, 0, 0, 255);
$red = ImageColorAllocate($image, 255, 0 , 0);

//draw rectangle
ImageFilledRectangle($image, 1, 299, 28, $figure, $red);

//output image to browser
header ("Content-type: image/png");
ImagePng($image);

//clean up 
ImageDestroy($image);

 

$figure is the variable that sets the height of the image.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.