Jump to content

GD Image help


jay83r

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/253121-gd-image-help/#findComment-1297671
Share on other sites

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);

 

 

  ?>

 

Link to comment
https://forums.phpfreaks.com/topic/253121-gd-image-help/#findComment-1297674
Share on other sites

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);

?>

Link to comment
https://forums.phpfreaks.com/topic/253121-gd-image-help/#findComment-1297707
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.