Image Copy with PHP and GD
Lesson 3: Image Manipulation

You can get different hues of color with the red gradangles posted in Lesson 1 by taking them to IM and clicking on Enhance, putting in a parameer and checking hue. Here is a sample of some colors available through that method. For this lesson I have colored, composited and resized angle 90 and -90. The images are all 50x300. In this lesson we can see how PHP will chop the image at the desired length. Transload these images for this lesson. Lesson3.zip

This is going to be the final output from our PHP script.

The 50x300 images are cropped as the image shows, by the script. The bottom half of the image, in white, is done with the 50x50 angles 180 just overlaid onto each other.

First make a page that is 400x370. Make a row across the page of the full red angle (50x300) starting from left to right.


CODES

Next start adding the colored angles: green, purple, aqua, gold from the left of the page. Begin by going in 25 pixels from the left on the background and 30 pixels from the top. The height of your green angle should also be 30 pixels shorter than the red angle. So if you've gone down 30 from the top and up 30 from the bottom you need to subtract 60 from the height of the green angle. Next is purple which should overlap the green by 25 pixels making it 50 pixels from the left on the background. It should come down 60 from the top and 60 from the bottom so 300-120=180 for the height. Follow the same logic for the aqua and the gold angles. Then start all over again with the green starting from the right of the page. The page is 400 wide. The angle is 50. So for the angle to be 25 pixels from the right side it needs to begin copying at 325 (325+50=375).



CODES

Next we'll add the white angles. These are wB180.jpg for the top half and wG180.jpg for the bottom half. They begin beneath the green angle which is 50 from the left and ends at 270 from the top. White begins there. Then they overlap by 25 pixels. Follow the image toward the center. Then begin from the left side of the page.



CODES

Now add the gradMod.jpg to the center. I placed her at the end of the codes but then the two top most white grads were covered by her. Next I placed those codes after the gradMod image so that they appear on top of the image.

imagecopy($im, $mod, 150, 60, 0, 0, 100, 292);

And here is the complete code for the image CODES

In the next lesson we're going to cut this script down with Loops.

LESSON 4