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
https://forums.phpfreaks.com/topic/150302-php-create-image-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.