CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Axis--Image--Test.php
Go to the documentation of this file.
1 <?PHP
2
3 #
4 # Axis--Image--Test.php
5 # Test scaffolding for the AxisPHP Image object.
6 #
7 # Copyright 2002-2003 Axis Data
8 # This code is free software that can be used or redistributed under the
9 # terms of Version 2 of the GNU General Public License, as published by the
10 # Free Software Foundation (http://www.fsf.org).
11 #
12 # Author: Edward Almasy (ealmasy@axisdata.com)
13 #
14 # Part of the AxisPHP library v1.2.5
15 # For more information see http://www.axisdata.com/AxisPHP/
16 #
17
18 require_once("Axis--Image.php");
19
20 $Img = new Image("TestImage1.jpg");
21 printf("Image Manipulation Method: %s<br>\n", $Img->ImageManipulationMethod());
22
23 ?>Original #1:<br><img src="TestImage1.jpg"><br><br><br><?PHP
24
25 $Img = new Image("TestImage1.jpg");
26 $Img->ScaleTo(100, 100);
27 $Img->SaveAs("TestImage--TEMP1.jpg");
28 ?>JPEG scaled to 100w by 100h:<br><img src="TestImage--TEMP1.jpg"><br><br><br><?PHP
29
30 $Img = new Image("TestImage1.jpg");
31 $Img->ScaleTo(100, 100, TRUE);
32 $Img->SaveAs("TestImage--TEMP4.jpg");
33 ?>JPEG scaled to 100w by 100h with aspect ration maintained:<br><img src="TestImage--TEMP4.jpg"><br><br><br><?PHP
34
35 $Img = new Image("TestImage1.jpg");
36 $Img->CropTo(300, 200, 50, 300);
37 $Img->SaveAs("TestImage--TEMP2.jpg");
38 ?>JPEG cropped to 300w by 200h:<br><img src="TestImage--TEMP2.jpg"><br><br><br><?PHP
39
40 $Img = new Image("TestImage1.jpg");
41 $Img->CropTo(300, 200, 50, 300);
42 $Img->SaveAs("TestImage--TEMP2.jpg");
43 ?>JPEG cropped to 300w by 200h:<br><img src="TestImage--TEMP2.jpg"><br><br><br><?PHP
44
45 if (imagetypes() & IMG_GIF)
46 {
47 $Img = new Image("TestImage1.jpg");
48 $Img->ScaleTo(50, 300);
49 $Img->SaveAs("TestImage--TEMP3.gif");
50 ?>GIF scaled to 50w by 300h:<br><img src="TestImage--TEMP3.gif"><br><br><br><?PHP
51 }
52 else
53 {
54 print("GIF image output not supported on this server<br><br><br>\n");
55 }
56
57 ?>Original #2:<br><img src="TestImage2.jpg"><br><br><br><?PHP
58
59 $Img = new Image("TestImage2.jpg");
60 $Img->ScaleTo(100, 100, TRUE);
61 $Img->SaveAs("TestImage--TEMP5.jpg");
62 ?>JPEG scaled to 100w by 100h with aspect ration maintained:<br><img src="TestImage--TEMP5.jpg"><br><br><br><?PHP
63
64 $Img = new Image("TestImage2.jpg");
65 $Img->ScaleTo(100, 200, TRUE);
66 $Img->SaveAs("TestImage--TEMP6.jpg");
67 ?>JPEG scaled to 100w by 200h with aspect ration maintained:<br><img src="TestImage--TEMP6.jpg"><br><br><br><?PHP
68
69 $Img = new Image("TestImage2.jpg");
70 $Img->ScaleTo(200, 100, TRUE);
71 $Img->SaveAs("TestImage--TEMP7.jpg");
72 ?>JPEG scaled to 200w by 100h with aspect ration maintained:<br><img src="TestImage--TEMP7.jpg"><br><br><br><?PHP
73
74 ?>
75