Nicht mehr ganz neu hier
Moin ich habe ein kleines Problem, ich habe mit imagecreate ein punkt auf einem Bild erzeugt die Koordinaten wurden aus einer db ausgelesen was auch ohne Probleme ging
Nun wollte ich den Punkt durch ein Bild ersetzten welches variiert das Bild drauf zu erzeugen war kein Problem nur lassen sich die Koordinaten nicht drin übertragen so das das Bild immer links in der ecke ist.
vieleicht hat jemand eine idee.
der code
Hier habe ich versucht es einzubauen
Nun wollte ich den Punkt durch ein Bild ersetzten welches variiert das Bild drauf zu erzeugen war kein Problem nur lassen sich die Koordinaten nicht drin übertragen so das das Bild immer links in der ecke ist.
vieleicht hat jemand eine idee.
der code
Code:
<?php
include('mysql.php');
$im = imagecreatefromjpeg('maps/wildnis.jpg');
// redefine the user error constants - PHP 4 only
define (FATAL,E_USER_ERROR);
define (ERROR,E_USER_WARNING);
define (WARNING,E_USER_NOTICE);
// set the error reporting level for this script
error_reporting (FATAL | ERROR);
// error handler function
function myErrorHandler ($errno, $errstr, $errfile, $errline) {
switch ($errno) {
case FATAL:
mysql_query('insert into errorlog (errlog, timed) values ("FATAL ['.$errno.'] '.$errstr.' - Fatal error in line '.$errline.' of file '.$errfile.', PHP '.PHP_VERSION.' ('.PHP_OS.') - Aborting...", NOW())');
break;
case ERROR:
mysql_query('insert into errorlog (errlog, timed) values ("ERROR ['.$errno.'] '.$errstr.'", NOW())');
break;
case WARNING:
mysql_query('insert into errorlog (errlog, timed) values ("WARNING ['.$errno.'] '.$errstr.'", NOW())');
break;
default:
mysql_query('insert into errorlog (errlog, timed) values ("Unkown error type ['.$errno.'] '.$errstr.'", NOW())');
break;
}
}
// set to the user defined error handler
//$old_error_handler = set_error_handler("myErrorHandler");
// 730*730
define("XMOVE", 368); //
define("YMOVE", 363); //
define("RATIO", 0.3579);
define("FONTFILE", "tahoma.ttf");
$xmove = XMOVE;
$ymove = YMOVE;
$fontfile = FONTFILE;
$fill = ImageColorClosest($im, 251, 121, 34);
$white = ImageColorClosest($im, 255, 255, 255);
$black = ImageColorClosest($im, 0, 0, 0);
$red = ImageColorClosest($im, 255, 0, 0);
$green = ImageColorClosest($im, 0, 255, 0);
$blue = ImageColorClosest($im, 0, 0, 255);
$yellow = ImageColorClosest($im, 255, 255, 0);
$cola = array( ImageColorClosest($im, 255, 255, 255),
ImageColorClosest($im, 255, 255, 0),
ImageColorClosest($im, 255, 0, 0),
ImageColorClosest($im, 0, 255, 0),
ImageColorClosest($im, 0, 0, 255),
ImageColorClosest($im, 255, 0, 255),
ImageColorClosest($im, 0, 255, 255),
ImageColorClosest($im, 0, 0, 0) );
header("Content-Type: image/jpeg");
function ConvertX($thisx)
{
return round(((-$thisx)*RATIO)+XMOVE);
}
function ConvertY($thisy)
{
return round(($thisy*RATIO)+YMOVE);
}
Hier habe ich versucht es einzubauen
Code:
}
} else if ($_GET['merch'] > 0) {
$merch = $_GET['merch'];
$sql = 'select cx, cy
from logo
where id
and id = '.$merch;
$result = mysql_query($sql);
list($homecx, $homecy) = mysql_fetch_row($result);
$homex = ConvertX(-$homecx);
$homey = ConvertY(-$homecy);
$i = -1;
$sql = 'select cx, cy, id, cityid, dename
from logo
where id
and cityid = '.$merch.'
order by id';
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
if ($prev <> $row['goodsid']) { $i++; }
$x = ConvertX($row['cx']);
$y = ConvertY($row['cy']);
// imagesetthickness($im,4);
// imageline($im,$homex,$homey,$x,$y,$white);
imagesetthickness($im,3);
imageline($im,$homex,$homey,$x,$y,$cola[$i]);
imagefilledellipse($im,$x,$y,12,12,$yellow);
imagefilledellipse($im,$x,$y,8,8,$fill);
$prev = $row['dename'];
}
imagecopyresampled($im);
// Wasserzeichen einbinden
$transition = 100;
$watermarkfile = imagecreatefrompng('wartung.png');
$waternarkpic_width = 80;
$waternarkpic_height = 70;
$watermarkdest_x = $width / 2 - ($x / 2);
$watermarkdest_y = $height / 2 - ($y / 2);
imagecopymerge($im, $watermarkfile, $watermarkdest_x, $watermarkdest_y,0,0, $waternarkpic_width, $waternarkpic_height, $transition);
ImageJPEG($im,'',40);
} else {
ImageJPEG($im,'',40);
}
exit;
?>