Thanks for the coding hint, but I am looking for an alogorithm, not for the list of image manipulation functions. The issues, which have to be addressed by the algorithm are:
1) Moved pictures cannot be too far from their original position
2) By moving, you cannot create a "spageti" picture
3) Moved pictures cannot overlap any line or position of any other picture
Main Topics
Browse All Topics





by: GEM100Posted on 2007-07-22 at 04:53:42ID: 19542337
Line drawing: en/functio n.imagelin e.php
en/ functio n.imagecre atefromjpe g.php
py
.us/img164 /5175/topr b3.jpg","h ttp://img1 23.imagesh ack.us/img 123/9056/l eftij4.jpg ","http:// miniprofil e.xfire.co m/bg/bg/ty pe/1/ black burnperson .png", "http://img67.imageshack.u s/img67/47 86/rightnt 1.jpg","ht tp://img12 3.imagesha ck.us/img1 23/4891/bo ttomtp5.jp g"); ; imagesx($i mgBuf[0]), imagesy($i mgBuf[0])) ; ,imagesx($ imgBuf[1]) ,imagesy($ imgBuf[1]) ); 0,imagesx( $imgBuf[2] ),imagesy( $imgBuf[2] )); ,0,imagesx ($imgBuf[3 ]),imagesy ($imgBuf[3 ])); 0,imagesx( $imgBuf[4] ),imagesy( $imgBuf[4] ));
esize
http://www.php.net/manual/
Image creation:
http://www.php.net/manual/
Use imagecopy() to combine images:
http://www.php.net/imageco
Here is sample code from web showing image combination:
<?
header ("Content-type: image/png");
$src = array ("http://img164.imageshack
$imgBuf = array ();
foreach ($src as $link)
{
switch(substr ($link,strrpos ($link,".")+1))
{
case 'png':
$iTmp = imagecreatefrompng($link);
break;
case 'gif':
$iTmp = imagecreatefromgif($link);
break;
case 'jpeg':
case 'jpg':
$iTmp = imagecreatefromjpeg($link)
break;
}
array_push ($imgBuf,$iTmp);
}
$iOut = imagecreatetruecolor ("450","131") ;
imagecopy ($iOut,$imgBuf[0],0,0,0,0,
imagedestroy ($imgBuf[0]);
imagecopy ($iOut,$imgBuf[1],0,54,0,0
imagedestroy ($imgBuf[1]);
imagecopy ($iOut,$imgBuf[2],15,54,0,
imagedestroy ($imgBuf[2]);
imagecopy ($iOut,$imgBuf[3],292,54,0
imagedestroy ($imgBuf[3]);
imagecopy ($iOut,$imgBuf[4],0,117,0,
imagedestroy ($imgBuf[4]);
imagepng($iOut);
?>
To prevent overlapping, you can use calculations with image height/width:
http://www.php.net/getimag
and calculating positions.