slushpuppie Posted November 2, 2007 Share Posted November 2, 2007 new to drawing with php... what i need to do is make some type of mark on an image of a meter to show the users score in a survey. i found a this code to create an image from a jpg, what would i do to put a line on top of this image? if someone can show me how to at least draw a small line i know i'll be able to alter it to draw a little arrow or whatever i decide on, just can't figure out how to draw anything on an image. doesn't have to be this code if someone has a better idea. thanks a million!!! <?php function LoadJpeg($imgname){ $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ $im = imagecreatetruecolor(150, 30); /* Create a black image */ $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an errmsg */ imagestring($im, 1, 5, 5, "Error loading $imgname", $tc); } return $im; } header("Content-Type: image/jpeg"); $img = LoadJpeg("_images/meter.jpg"); imagejpeg($img); ?> Link to comment https://forums.phpfreaks.com/topic/75820-php-drawing-help/ Share on other sites More sharing options...
tippy_102 Posted November 3, 2007 Share Posted November 3, 2007 Use "imageline" to draw lines. Lots of examples here: http://ca3.php.net/imageline Link to comment https://forums.phpfreaks.com/topic/75820-php-drawing-help/#findComment-384351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.