Jump to content

php drawing help


slushpuppie

Recommended Posts

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

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.