jay83r Posted December 13, 2011 Share Posted December 13, 2011 Hi there, i want to draw dynamic lines by using ImageLine($image, 0, 0, 100, 100, $color) but i want to store the line co-ordinates in a mysql database so i can give each line a meaningful name and call them and display when I want to... anyone with anyideas? Quote Link to comment https://forums.phpfreaks.com/topic/253121-gd-image-help/ Share on other sites More sharing options...
xyph Posted December 13, 2011 Share Posted December 13, 2011 Seems like you've summed up exactly what you should do. I'm not sure what you've left out? Just keep all the lines in a table, with x1,y1 and x2,y2 columns, along with columns for an id and whatever meta data you need to store. If you need help with the actual code, I suggest posting what you have so far. If you don't even know where to start, I suggest checking out the introduction section of the PHP manual. Quote Link to comment https://forums.phpfreaks.com/topic/253121-gd-image-help/#findComment-1297671 Share on other sites More sharing options...
jay83r Posted December 14, 2011 Author Share Posted December 14, 2011 i've got this but i'm totally lost with it, i'm getting a header issue, and im not sure how to to do the mysql part. <?php $image = ImageCreate(200, 50); $background_color = ImageColorAllocate($image, 255, 255, 255); // white $gray = ImageColorAllocate($image, 204, 204, 204); // gray ImageFilledRectangle($image, 50, 10, 150, 40, $gray); $image = ImageCreate(200, 50); $background_color = ImageColorAllocate($image, 255, 255, 255); // white $gray = ImageColorAllocate($image, 204, 204, 204); // gray ImageFilledRectangle($image, 50, 10, 150, 40, $gray); header('Content-type: image/png'); ImagePNG($image); ?> Quote Link to comment https://forums.phpfreaks.com/topic/253121-gd-image-help/#findComment-1297674 Share on other sites More sharing options...
jay83r Posted December 14, 2011 Author Share Posted December 14, 2011 i've fixed the header issue, and are able to draw a line with text, but how to i reference this to a table in a database <?php // set the HTTP header type to PNG header("Content-type: image/png"); ?> <?php header ("Content-type: image/png"); $handle = ImageCreate (640, 480) or die ("Cannot Create image"); $bg_color = ImageColorAllocate ($handle, 255, 255, 255); $txt_color = ImageColorAllocate ($handle, 0, 0, 0); $line_color = ImageColorAllocate ($handle, 0, 0, 0); ImageLine($handle, 0, 0, 200, 0, $line_color); ImageString ($handle, 8, 5, 18, "base line", $txt_color); ImagePng ($handle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/253121-gd-image-help/#findComment-1297707 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.