Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.