View Single Post
02-25-2011, 01:46 AM
#8
dlcoding is offline dlcoding
Status: I'm new around here
Join date: Nov 2010
Location: Exmouth
Expertise: Software And Web Development
Software: Dreamweaver, Visual Studio
 
Posts: 6
iTrader: 0 / 0%
 

dlcoding is on a distinguished road

  Old

I've pretty much got it done after a few google searches on Trig. If any of you are interested, here is the basis of my code:

PHP Code:
<?php

header
("Content-type: image/png");

// main image size
$Imgwidth 540;
$Imgheight 540;

//options
$render_circle false;

// circle size
  
$centerPoint = array(260,260);
  
$radius 200;
  
// number of images to distribute
$count 30;

// default size for images
$imageSizes = array(2525);

$image imagecreate($Imgwidth$Imgheight) or die("Failed to create stream");
$bgcolor imagecolorallocate($image255255255);

 
  
 if (
$render_circle)
 {
     
// Render circle
     
for ($i=0$i 360$i++)
     {
        
$degInRad deg2rad($i);
        
imagesetpixel($image, (cos($degInRad)*$radius)+$centerPoint[0], (sin($degInRad)*$radius)+$centerPoint[1], $color);
       
     }
 }
 
 
// calculate points
 
$distdeg2rad(6.28/$count);
 
 for (
$n=0$n $count$n++)
 {
    
$deg rad2deg($dist $n);
    
    
$image2 imagecreate($imageSizes[0],$imageSizes[1]) or die("Failed to create stream");
    
$bgcolor imagecolorallocate($image000);
    
imagecopy($image$image2
              ((
cos($deg)*$radius)+$centerPoint[0])-($imageSizes[0]/2) ,
              ((
sin($deg)*$radius)+$centerPoint[1])-($imageSizes[1]/2) ,
              
00imagesx($image2), imagesy($image2));
    
    
imagesetpixel($image, (cos($deg)*$radius)+$centerPoint[0], (sin($deg)*$radius)+$centerPoint[1], imagecolorallocate($image25500));
   
 }

imagepng($image);
imagedestroy($image);

?>