ashrobbins87 Posted March 20, 2009 Share Posted March 20, 2009 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 More sharing options...
GingerRobot Posted March 20, 2009 Share Posted March 20, 2009 Well it's just simple maths, right? If 0 is the top of the canvas, x is the bottom of it and we need the top of the image to be drawn with height h, it's just x-h. Link to comment https://forums.phpfreaks.com/topic/150302-php-create-image-question/#findComment-789413 Share on other sites More sharing options...
ashrobbins87 Posted March 20, 2009 Author Share Posted March 20, 2009 i really dont understand that Link to comment https://forums.phpfreaks.com/topic/150302-php-create-image-question/#findComment-789467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.